This should fix ArrayIndexOutOfBoundsException.