fix for endless loop