small Lua code optimizations