diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw
index 7efd5afc9127798c3cfb6cf51cd073a3a211725a..59c223d07cfb26452cf51860eb9f870a6fa70221 100644
--- a/src/uncategorized/BackwardsCompatibility.tw
+++ b/src/uncategorized/BackwardsCompatibility.tw
@@ -2358,6 +2358,18 @@ Setting missing slave variables:
 <<if ndef _Slave.canRecruit>>
 	<<set _Slave.canRecruit = 0>>
 <</if>>
+<<if _Slave.rivalry != 0>>
+	<<set _backwardsCompatibility = $slaveIndices[_Slave.rivalryTarget]>>
+	<<if ndef _backwardsCompatibility>><<set _Slave.rivalry = 0, _Slave.rivalryTarget = 0>><</if>>
+<</if>>
+<<if _Slave.relationship > 0>>
+	<<set _backwardsCompatibility = $slaveIndices[_Slave.relationshipTarget]>>
+	<<if ndef _backwardsCompatibility>><<set _Slave.relationship = 0, _Slave.relationshipTarget = 0>><</if>>
+<</if>>
+<<if $familyTesting == 0 && _Slave.relation != 0>>
+	<<set _backwardsCompatibility = $slaveIndices[_Slave.relationTarget]>>
+	<<if ndef _backwardsCompatibility>><<set _Slave.relation = 0, _Slave.relationTarget = 0>><</if>>
+<</if>>
 <<if ndef _Slave.buttplugAttachment>>
 	<<set _Slave.buttplugAttachment = "none">>
 <</if>>
diff --git a/src/uncategorized/pUndergroundRailroad.tw b/src/uncategorized/pUndergroundRailroad.tw
index 75a83342985a74971603ce5167d061264b3e6a94..84379644fcd2df5e77be0fbc86a6506f974d598e 100644
--- a/src/uncategorized/pUndergroundRailroad.tw
+++ b/src/uncategorized/pUndergroundRailroad.tw
@@ -94,7 +94,8 @@ that several nondescript citizens she sees occasionally at work have passed a fe
 	You calmly inform her that she's free to go. She almost collapses with shock, but turns and hurries out of the arcology, tears streaming from her eyes. She wanders down through the arcology, attracting little notice. One moment the monitors have her struggling through a dense-packed crowd, and the next, they don't.
 	<<if $activeSlave.relationship > 0>>
 		<<set $i = $slaveIndices[$activeSlave.relationshipTarget]>>
-		<<set $activeSlave.relationshipTarget = 0, $activeSlave.relationship = 0, $slaves[$i].relationshipTarget = 0, $slaves[$i].relationship = 0>>
+		<<set $activeSlave.relationshipTarget = 0, $activeSlave.relationship = 0>>
+		<<if def $i>><<set $slaves[$i].relationshipTarget = 0, $slaves[$i].relationship = 0>><<else>>@@.red;Error, relationshipTarget not found.@@<</if>>
 	<</if>>
 	<<set $traitor = $activeSlave>>
 	<<set $traitorStats = {PCpregSource: 0, PCmother: 0, PCfather: 0, traitorMother: [], traitorFather: [], traitorPregSources: [], traitorMotherTank: [], traitorFatherTank: []}>>
diff --git a/src/uncategorized/reFormerAbolitionist.tw b/src/uncategorized/reFormerAbolitionist.tw
index d69e8482c64d361524006a9f4a0a7dfdb407e881..44b1ede9b3f7395b50e9446aa426a95aba197e67 100644
--- a/src/uncategorized/reFormerAbolitionist.tw
+++ b/src/uncategorized/reFormerAbolitionist.tw
@@ -7,7 +7,7 @@
 <<set $returnTo = "RIE Eligibility Check">>
 
 <<if $legendaryFacility == 1>>
-	<<set $activeSlave = $slaves[$slaveIndices[$legendaryAbolitionistID]]>>
+	<<set $activeSlave = getSlave($legendaryAbolitionistID)>>
 <<else>>
 	<<set $activeSlave = $eventSlave>>
 <</if>>
diff --git a/src/uncategorized/recETS.tw b/src/uncategorized/recETS.tw
index 8f33e8f8bc44f4774bc2a5796b2e636f8f8bfa49..32c2ae0faddcda8c5fddc974ae79093fab219adc 100644
--- a/src/uncategorized/recETS.tw
+++ b/src/uncategorized/recETS.tw
@@ -909,6 +909,8 @@ This call is coming from a public kiosk, which is usually an indication that the
 	<<set $activeSlave.father = 0>>	
 	<<set $activeSlave.relation = 0>>
 	<<set $activeSlave.relationTarget = 0>>
+	<<set $activeSlave.rivalry = 0>>
+	<<set $activeSlave.rivalryTarget = 0>>
 	<<AddSlave $activeSlave>>
 	<<set $cash -= $contractCost>>
 	<<replace "#result">>
diff --git a/src/uncategorized/rename.tw b/src/uncategorized/rename.tw
index 7b76964abd7889f98af1fb2c194c1d61e7f09341..0a6194ce5357103a6803a6aff9f95aa4e154bc3c 100644
--- a/src/uncategorized/rename.tw
+++ b/src/uncategorized/rename.tw
@@ -75,6 +75,7 @@
 <<if $oldSurname != $activeSlave.slaveSurname>>
 <<if $activeSlave.relationship >= 5>>
 	<<set _i = $slaveIndices[$activeSlave.relationshipTarget]>>
+	<<if ndef _i>>@@.red;Error, relationshipTarget not found.@@<</if>>
 	<<if $slaves[_i].slaveSurname>>
 	<<if $activeSlave.slaveSurname == $slaves[_i].slaveSurname>>
 		She's touched that she now shares a surname with her wife $slaves[_i].slaveName $slaves[_i].slaveSurname, and is @@.mediumaquamarine;more confident than ever@@ that you intend to keep them together in marital bliss.
diff --git a/src/uncategorized/saLongTermEffects.tw b/src/uncategorized/saLongTermEffects.tw
index a057b1c55ddcdf7064fe5fb9acb892ad04b28347..337e86ca65fdbe33cbdd926cef1155e3dede9c00 100644
--- a/src/uncategorized/saLongTermEffects.tw
+++ b/src/uncategorized/saLongTermEffects.tw
@@ -4357,15 +4357,16 @@
 
 	<<default>> /* random impregnation chance on other assignments - consider relationships first */
 		<<if (_conceptionSeed > 80) && (($slaves[$i].vaginalCount > 0) || ($slaves[$i].analCount > 0 && $slaves[$i].mpreg > 0))>> /* TODO: compare to previous week totals? */
-			<<for _m = 0; _m < $slaves.length; _m++>>
-				<<if $slaves[$i].relationshipTarget > 0>>
-					<<set _tempLover = getSlave($slaves[$i].relationshipTarget)>>
-				<<elseif $slaves[$i].rivalryTarget > 0>>
-					<<set _tempRival = getSlave($slaves[$i].rivalryTarget)>>
-				<<elseif $slaves[$i].subTarget > 0>>
-					<<set _tempSub = getSlave($slaves[$i].subTarget)>>
-				<</if>>
-			<</for>>
+			<<if $slaves[$i].relationshipTarget > 0>>
+				<<set _tempLover = getSlave($slaves[$i].relationshipTarget)>>
+				<<if ndef _tempLover>>@@.red;Error, relationshipTarget not found.@@<</if>>
+			<<elseif $slaves[$i].rivalryTarget > 0>>
+				<<set _tempRival = getSlave($slaves[$i].rivalryTarget)>>
+				<<if ndef _tempRival>>@@.red;Error, rivalryTarget not found.@@<</if>>
+			<<elseif $slaves[$i].subTarget > 0>>
+				<<set _tempSub = getSlave($slaves[$i].subTarget)>>
+				<<if ndef _tempSub>>@@.red;Error, subTarget not found.@@<</if>>
+			<</if>>
 			<<if ($PC.dick == 1) && (($slaves[$i].relationship == -3) || ($slaves[$i].relationship == -2)) && ($slaves[$i].eggType == "human")>>
 				<<set $slaves[$i].pregSource = -1>>
 			<<elseif ($slaves[$i].relationship > 2) && canImpreg($slaves[$i], _tempLover)>> /* erection not needed for impregnation via consensual sex play (FWB or better) */
@@ -5002,7 +5003,8 @@
 		<</if>>
 	<<else>>
 		<<if $slaves[$i].pregKnown == 1 && $slaves[$i].pregSource > 0>>
-			<<set _lte = getSlave($slaves[$i].pregSource)>>
+			<<set _lte = $slaveIndices[$slaves[$i].pregSource]>>
+			<<if ndef _lte>>@@.red;Error, pregSource not found.@@<</if>>
 			<<if $slaves[_lte].race == $arcologies[0].FSSubjugationistRace>>
 				Society @@.red;strongly disapproves@@ of your allowing $slaves[$i].slaveName to be miscegenated by a $arcologies[0].FSSubjugationistRace subhuman like $slaves[_lte].slaveName.
 				<<FSChangePorn "Subjugationist" -2>>
diff --git a/src/uncategorized/saServeThePublic.tw b/src/uncategorized/saServeThePublic.tw
index 5f7cc778250ebd26d58d4bc8596d5cfcff2ee543..2446e8dea4befc0b6e1b1b0c5bf56661dbf87534 100644
--- a/src/uncategorized/saServeThePublic.tw
+++ b/src/uncategorized/saServeThePublic.tw
@@ -495,7 +495,7 @@ Her appearance attracted $beauty members of the public (<<print Math.trunc($beau
 <<else>>
 	<<if $slaves[$i].relation != 0>>
 		<<set $j = $slaveIndices[$slaves[$i].relationTarget]>>
-		<<if $slaves[$j].assignment == $slaves[$i].assignment>>
+		<<if def $j && $slaves[$j].assignment == $slaves[$i].assignment>>
 			Since her $slaves[$j].relation $slaves[$j].slaveName is a public slut too, she earns extra attention.
 			<<if $arcologies[0].FSEgyptianRevivalist > 20>>
 				Citizens are very excited about being able to participate in incestuous sex like the ancient Egyptians.
@@ -507,7 +507,7 @@ Her appearance attracted $beauty members of the public (<<print Math.trunc($beau
 <</if>>
 <<if $slaves[$i].relationship > 0>>
 	<<set $j = $slaveIndices[$slaves[$i].relationshipTarget]>>	
-	<<if $slaves[$j].assignment == $slaves[$i].assignment>>
+	<<if def $j && $slaves[$j].assignment == $slaves[$i].assignment>>
 		Her
 		<<if $slaves[$j].relationship <= 1>>
 			friend
@@ -527,7 +527,7 @@ Her appearance attracted $beauty members of the public (<<print Math.trunc($beau
 <</if>>
 <<if $slaves[$i].rivalry != 0>>
 	<<set $j = $slaveIndices[$slaves[$i].rivalryTarget]>>	
-	<<if $slaves[$j].assignment == $slaves[$i].assignment>>
+	<<if def $j && $slaves[$j].assignment == $slaves[$i].assignment>>
 		She's a little less effective due to her mutual dislike with $slaves[$j].slaveName.
 	<</if>>
 <</if>>
diff --git a/src/uncategorized/saWhore.tw b/src/uncategorized/saWhore.tw
index 0ffcf9444bac5689f58630746dd9e86b43639674..482b9965bd2642e4e1a1d12ee5dadb06416a0891 100644
--- a/src/uncategorized/saWhore.tw
+++ b/src/uncategorized/saWhore.tw
@@ -497,7 +497,7 @@ Her appearance attracted $beauty customers (<<print Math.trunc($beauty/7)>> a da
 <<else>>
 	<<if $slaves[$i].relation != 0>>
 		<<set $j = $slaveIndices[$slaves[$i].relationTarget]>>
-		<<if $slaves[$j].assignment == $slaves[$i].assignment>>
+		<<if def $j && $slaves[$j].assignment == $slaves[$i].assignment>>
 			Since her $slaves[$j].relation $slaves[$j].slaveName is selling herself too, she earns extra ¤ by working with her.
 			<<if $arcologies[0].FSEgyptianRevivalist > 20>>
 				Customers are very enthusiastic about being able to participate in incestuous sex like the ancient Egyptians.
@@ -509,7 +509,7 @@ Her appearance attracted $beauty customers (<<print Math.trunc($beauty/7)>> a da
 <</if>> /*closes extended family mode */
 <<if $slaves[$i].relationship > 0>>
 	<<set $j = $slaveIndices[$slaves[$i].relationshipTarget]>>
-	<<if $slaves[$j].assignment == $slaves[$i].assignment>>
+	<<if def $j && $slaves[$j].assignment == $slaves[$i].assignment>>
 		Her
 		<<if $slaves[$j].relationship <= 1>>
 			friend
@@ -529,7 +529,7 @@ Her appearance attracted $beauty customers (<<print Math.trunc($beauty/7)>> a da
 <</if>>
 <<if $slaves[$i].rivalry != 0>>
 	<<set $j = $slaveIndices[$slaves[$i].rivalryTarget]>>
-	<<if $slaves[$j].assignment == $slaves[$i].assignment>>
+	<<if def $j && $slaves[$j].assignment == $slaves[$i].assignment>>
 		She earns a little less ¤ due to bickering with $slaves[$j].slaveName.
 	<</if>>
 <</if>>
diff --git a/src/uncategorized/seRetirement.tw b/src/uncategorized/seRetirement.tw
index e14ae7838d093bf11124a24377f6b9a3df5fe0f8..00af41c7c722aa03155dca6ffe9deb749fffa88b 100644
--- a/src/uncategorized/seRetirement.tw
+++ b/src/uncategorized/seRetirement.tw
@@ -20,6 +20,7 @@ in a way that will fill the rest of your property with envy and @@.mediumaquamar
 <</for>>
 <<if $activeSlave.relationship > 3>>
 	<<set _sr = $slaveIndices[$activeSlave.relationshipTarget]>>
+	<<if ndef _sr>>@@.red;Error, relationshipTarget not found.@@<</if>>
 	$slaves[_sr].slaveName, for her part, is @@.hotpink;overjoyed,@@ though also a bit sad. She looks forward to joining $activeSlave.slaveName one day.
 	<<set $slaves[_sr].devotion += 10>>
 <</if>>