change Lua 5.1 compat functions to fit LuaJIT.