fix out of bounds Index