End loop if length check fails