Fixed iteration bug