diff --git a/.luacheckrc b/.luacheckrc
index b9ee54c02d02b605e3e4b295f27acdc85625d1b5..36299c6db1d26088c8e38bc330599ca4c870dc34 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -89,13 +89,13 @@ files["targets/*"] = {
 		"defaults",
 		"device",
 		"env",
-		"envtrue",
 		"exec",
 		"exec_capture",
 		"exec_capture_raw",
 		"exec_raw",
 		"factory_image",
 		"include",
+		"istrue",
 		"no_opkg",
 		"packages",
 		"sysupgrade_image",
diff --git a/scripts/target_lib.lua b/scripts/target_lib.lua
index d5133b1ee27a324586227fb88de05536d80147cd..f3e372b58bbcaa41bbbd43616d007b9ba615dc7f 100644
--- a/scripts/target_lib.lua
+++ b/scripts/target_lib.lua
@@ -15,11 +15,6 @@ local env = setmetatable({}, {
 })
 F.env = env
 
-local envtrue = setmetatable({}, {
-	__index = function(_, k) return (tonumber(os.getenv(k)) or 0) > 0 end
-})
-F.envtrue = envtrue
-
 assert(env.GLUON_SITEDIR)
 assert(env.GLUON_TARGETSDIR)
 assert(env.GLUON_RELEASE)
@@ -55,8 +50,12 @@ for dev in string.gmatch(env.GLUON_DEVICES or '', '%S+') do
 	unknown_devices[dev] = true
 end
 
+function F.istrue(v)
+	return (tonumber(v) or 0) > 0
+end
+
 local function want_device(dev, options)
-	if options.broken and not envtrue.BROKEN then
+	if options.broken and not F.istrue(env.BROKEN) then
 		return false
 	end
 	if options.deprecated and env.GLUON_DEPRECATED == '0' then
diff --git a/targets/generic b/targets/generic
index 65982ef4bfbdc9a7a4f757194d45d9c94b896b42..fc4ed0ea9db37359ade7e6ebbbfbe3ed163ab216 100644
--- a/targets/generic
+++ b/targets/generic
@@ -47,11 +47,11 @@ config '# CONFIG_KERNEL_IPV6_MROUTE is not set'
 try_config 'CONFIG_TARGET_MULTI_PROFILE=y'
 try_config 'CONFIG_TARGET_PER_DEVICE_ROOTFS=y'
 
-if envtrue.GLUON_MULTIDOMAIN then
+if istrue(env.GLUON_MULTIDOMAIN) then
 	config 'CONFIG_GLUON_MULTIDOMAIN=y'
 end
 
-if envtrue.GLUON_DEBUG then
+if istrue(env.GLUON_DEBUG) then
 	config 'CONFIG_DEBUG=y'
 	config 'CONFIG_NO_STRIP=y'
 	config '# CONFIG_USE_STRIP is not set'