correction in for loop