fix some indexing issues in Lua prelude
a bugfix in ctor generator