Fixed endless loop