final endless loop fix