Corrected Bug of ArrayIndexOutOfBoundsException with marks at the end