More fixes to for loops