Fix ArrayIndexOutOfBoundsException.