bug fix in iterating loops