Fix loop iteration variable