finished check_sorting