for loop fixed