Update all_ids_sorted