Fixed Lua bugs