Fix iterator generation