fixes to loops.