ArrayIndexOutOfBounds fix