Fix iterator bug