fix issue with arrays and indexes