wrong implementation of iterating