correction for loop