updated loop fix