Lua fixes
Merge pull request #511 from satta/luafixes

Lua fixes