Made compatible with latest version of Lua (1.9)