Fix iterator moving backwards