added break for endless loop