Nasty bug with crash

Integration of the new sorting (with SEL, seems more natural to me)