for loop corrected