fix error for loop