diff --git a/mesecons/util.lua b/mesecons/util.lua
index 0a0640196a2b95e750d2983627d78d0c188a840b..b9b0cef8f36969e63cf18ffd39471a6ac3b62b58 100644
--- a/mesecons/util.lua
+++ b/mesecons/util.lua
@@ -157,10 +157,12 @@ function mesecon.tablecopy_stripfunctions(table) -- deep table copy, but remove
 	local newtable = {}
 
 	for idx, item in pairs(table) do
-		if type(item) == "table" then
-			newtable[idx] = mesecon.tablecopy(item)
-		elseif type(item) ~= "function" then
-			newtable[idx] = item
+		if type(idx) ~= "function" then
+			if type(item) == "table" then
+				newtable[idx] = mesecon.tablecopy_stripfunctions(item)
+			elseif type(item) ~= "function" then
+				newtable[idx] = item
+			end
 		end
 	end