Fixed event handling errors with LuaJIT