Fix for loop iteration