diff --git a/src/js/datatypeCleanupJS.js b/src/js/datatypeCleanupJS.js
index 3b5ecacbfb37141ffca81e6cf9b59506f0087849..eccfa425e4f6f6f014efa5b7bd6f8e9c6398a82b 100644
--- a/src/js/datatypeCleanupJS.js
+++ b/src/js/datatypeCleanupJS.js
@@ -1724,6 +1724,9 @@ window.EconomyDatatypeCleanup = function EconomyDatatypeCleanup() {
 	V.rentDefaults.upperClass = Math.max(+V.rentDefaults.upperClass, 0) || 180; /* nowhere modified */
 	V.rentDefaults.topClass = Math.max(+V.rentDefaults.topClass, 0) || 650; /* nowhere modified */
 
+	if (!V.whoreBudget) {
+		V.whoreBudget = {};
+	}
 	if (V.whoreBudget.lowerClass) {
 		V.whoreBudget.lowerClass = Math.max(+V.whoreBudget.lowerClass, 8) || 10;
 	} else {
@@ -1744,6 +1747,9 @@ window.EconomyDatatypeCleanup = function EconomyDatatypeCleanup() {
 	} else {
 		V.whoreBudget.topClass = (0.8 + (V.rent.topClass / V.rentDefaults.topClass) / 5) * 1500;
 	}
+	if (!V.NPCMarketShare) {
+		V.NPCMarketShare = {};
+	}
 	V.NPCMarketShare.lowerClass = Math.clamp(+V.NPCMarketShare.lowerClass, 0, 1000) || 0;
 	V.NPCMarketShare.middleClass = Math.clamp(+V.NPCMarketShare.middleClass, 0, 1000) || 0;
 	V.NPCMarketShare.upperClass = Math.clamp(+V.NPCMarketShare.upperClass, 0, 1000) || 0;
diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw
index 565679e7c9bb0c688aea1e2d6c09dcdbec008710..fcf2bd5e797f83fc92ef13b198024dafc8b26586 100644
--- a/src/uncategorized/BackwardsCompatibility.tw
+++ b/src/uncategorized/BackwardsCompatibility.tw
@@ -3050,6 +3050,9 @@ Setting missing global variables:
 <<if def $lowerClassSexDemand>>
 	<<unset $lowerClassSexDemand>>
 <</if>>
+<<if ndef $classSatisfied>>
+	<<set $classSatisfied = {}>>
+<</if>>
 <<if def $lowerClassSatisfied>>
 	<<set $classSatisfied.lowerClass = $lowerClassSatisfied>>
 	<<unset $lowerClassSatisfied>>
@@ -3063,10 +3066,16 @@ Setting missing global variables:
 <<if def $topClassSexDemand>>
 	<<unset $topClassSexDemand>>
 <</if>>
+<<if ndef $sexSubsidies>>
+	<<set $sexSubsidies = {}>>
+<</if>>
 <<if def $sexSubsidiesLC>>
 	<<set $sexSubsidies.lowerClass = $sexSubsidiesLC>>
 	<<unset $sexSubsidiesLC>>
 <</if>>
+<<if ndef $sexSupplyBarriers>>
+	<<set $sexSupplyBarriers = {}>>
+<</if>>
 <<if def $sexSupplyBarriersLC>>
 	<<set $sexSupplyBarriers.lowerClass = $sexSupplyBarriersLC>>
 	<<unset $sexSupplyBarriersLC>>