Fix a few iteration errors