Fixed iterator bug