Fix the iterator bug