Fixed redundant iterator in for loops