Various Lua fixes (thanks projectkk2glider!)