For loop fix