correctly sort reason selectors, #32521, from #31702