various small fixes in the Lua code.