Fix bug with reporting getClass() error and Lua stack