Fixed ArrayIndexOutOfBoundsException. Details... they are crucial!