fix ArrayIndexOutOfBoundsException