fixed some errors on index as Lua starts on 1