diff --git a/src/ui/contenttype.cpp b/src/ui/contenttype.cpp
index 125418a77..b06bf7f6c 100644
--- a/src/ui/contenttype.cpp
+++ b/src/ui/contenttype.cpp
@@ -284,6 +284,9 @@ static const CUnit *GetUnitRef(const CUnit &unit, EnumUnit e)
 	} else {
 		f = (100 * EvalNumber(this->ValueFunc)) / this->ValueMax;
 		f = f > 100 ? 100 : f;
+		if (f < 0) {
+			return;
+		}
 	}
 	int i = 0;
 
diff --git a/src/unit/script_unit.cpp b/src/unit/script_unit.cpp
index 5a59c4dc1..4f1dee924 100644
--- a/src/unit/script_unit.cpp
+++ b/src/unit/script_unit.cpp
@@ -1110,7 +1110,7 @@ static int CclGetUnitVariable(lua_State *l)
 			int pcnt = W * 100.0 / G;
 			lua_pushinteger(l, pcnt);
 		} else {
-			lua_pushinteger(l, 100);
+			lua_pushinteger(l, -1);
 		}
 	} else if (!strcmp(value, "IndividualUpgrade")) {
 		LuaCheckArgs(l, 3);