endless loop resolved