Fix iteration bug