infinite loop fix