Fix shiftedIndex crash