IndexOutOfBounds fix