diff --git a/devNotes/twine JS.txt b/devNotes/twine JS.txt
index 18946b5943a43641cf74eea74ed8720bcc6fe0ce..80cd464ea9020e74152972e8757df4bbc9973d25 100644
--- a/devNotes/twine JS.txt	
+++ b/devNotes/twine JS.txt	
@@ -30701,10 +30701,19 @@ window.generateNationality = function generateNationality(slave) {
 window.generateIntelligence = function generateIntelligence(slave) {
 	const gaussian = gaussianPair();
 	slave.intelligence = Intelligence.random();
-	if (gaussian[0] < gaussian[1] + slave.intelligence/29 - 0.35) { /* 40.23% chance if intelligence is 0, 99.26% chance if intelligence is 100 */
-		slave.intelligenceImplant = 15;
-		if (jsRandom(15,150) < slave.intelligence) {
-			slave.intelligenceImplant = 30;
+	if (State.variables.AgePenalty == 1 && slave.actualAge <= 24) {
+		if (gaussian[0] < gaussian[1] + slave.intelligence/29 + (slave.actualAge - 24)/8 - 0.35) {
+			slave.intelligenceImplant = 15;
+			if (slave.intelligenceImplant > 0 && jsRandom(15,150) < slave.intelligence) {
+				slave.intelligenceImplant = 30;
+			}
+		}
+	} else {
+		if (gaussian[0] < gaussian[1] + slave.intelligence/29 - 0.35) { /* 40.23% chance if intelligence is 0, 99.26% chance if intelligence is 100 */
+			slave.intelligenceImplant = 15;
+			if (slave.intelligenceImplant > 0 && jsRandom(15,150) < slave.intelligence) {
+				slave.intelligenceImplant = 30;
+			}
 		}
 	}
 };
diff --git a/src/js/slaveGenerationJS.tw b/src/js/slaveGenerationJS.tw
index 725ce64cc84ec36dbd5ec86d660473ee8f45c068..49d8ebb991c7db82e3389fa6f547355b8e6eb8b3 100644
--- a/src/js/slaveGenerationJS.tw
+++ b/src/js/slaveGenerationJS.tw
@@ -1415,10 +1415,19 @@ window.generateNationality = function generateNationality(slave) {
 window.generateIntelligence = function generateIntelligence(slave) {
 	const gaussian = gaussianPair();
 	slave.intelligence = Intelligence.random();
-	if (gaussian[0] < gaussian[1] + slave.intelligence/29 - 0.35) { /* 40.23% chance if intelligence is 0, 99.26% chance if intelligence is 100 */
-		slave.intelligenceImplant = 15;
-		if (jsRandom(15,150) < slave.intelligence) {
-			slave.intelligenceImplant = 30;
+	if (State.variables.AgePenalty == 1 && slave.actualAge <= 24) {
+		if (gaussian[0] < gaussian[1] + slave.intelligence/29 + (slave.actualAge - 24)/8 - 0.35) {
+			slave.intelligenceImplant = 15;
+			if (slave.intelligenceImplant > 0 && jsRandom(15,150) < slave.intelligence) {
+				slave.intelligenceImplant = 30;
+			}
+		}
+	} else {
+		if (gaussian[0] < gaussian[1] + slave.intelligence/29 - 0.35) { /* 40.23% chance if intelligence is 0, 99.26% chance if intelligence is 100 */
+			slave.intelligenceImplant = 15;
+			if (slave.intelligenceImplant > 0 && jsRandom(15,150) < slave.intelligence) {
+				slave.intelligenceImplant = 30;
+			}
 		}
 	}
 };
diff --git a/src/npc/acquisition.tw b/src/npc/acquisition.tw
index 4521c5294559120d53029802b8d0326b7a9aad16..c716220f5827544ab5f7e8b3b2d48cdef73cc71e 100644
--- a/src/npc/acquisition.tw
+++ b/src/npc/acquisition.tw
@@ -684,8 +684,10 @@ The previous owner seems to have left in something of a hurry.
 		<</for>>
 	<</for>>
 <</if>>
-<<set $averageTrust = $averageTrust/_slavesContributing>>
-<<set $averageDevotion = $averageDevotion/_slavesContributing>>
+<<if _slavesContributing != 0>>
+	<<set $averageTrust = $averageTrust/_slavesContributing>>
+	<<set $averageDevotion = $averageDevotion/_slavesContributing>>
+<</if>>
 <<set $enduringTrust = $averageTrust>>
 <<set $enduringDevotion = $averageDevotion>>
 
diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw
index 4957ab1e9ae70cebf1104e1b9f3c29a41ec8b705..f411dd07205d15d6dc547739398cd2777ae0a678 100644
--- a/src/uncategorized/BackwardsCompatibility.tw
+++ b/src/uncategorized/BackwardsCompatibility.tw
@@ -205,7 +205,10 @@
 <<if def $vaginaTotal>>
 	<<unset $vaginaTotal>>
 <</if>>
-
+<<set $enduringTrust = Number($enduringTrust) || 0>>
+<<set $enduringDevotion = Number($enduringDevotion) || 0>>
+<<set $averageTrust = Number($averageTrust) || 0>>
+<<set $averageDevotion = Number($averageDevotion) || 0>>
 
 /* pregmod stuff */
 
diff --git a/src/uncategorized/nextWeek.tw b/src/uncategorized/nextWeek.tw
index 7d5a7b7da8c31b65490cf25e5dd9dfa00fd34191..249d530cc45a6205eee21b59433642af1a95b71e 100644
--- a/src/uncategorized/nextWeek.tw
+++ b/src/uncategorized/nextWeek.tw
@@ -158,8 +158,10 @@
 		<<if $slaves[_i].pornTypePregnancy > 0>><<set $pornStarPregnancySluts++>><</if>>
 	<</if>>
 <</for>>
-<<set $averageTrust = $averageTrust/_slavesContributing>>
-<<set $averageDevotion = $averageDevotion/_slavesContributing>>
+<<if _slavesContributing != 0>>
+	<<set $averageTrust = $averageTrust/_slavesContributing>>
+	<<set $averageDevotion = $averageDevotion/_slavesContributing>>
+<</if>>
 <<set $enduringTrust = ($averageTrust+($enduringTrust*3))/4>>
 <<set $enduringDevotion = ($averageDevotion+($enduringDevotion*3))/4>>