fix problem 1 with for loop