use sort_by instead of sort

just a random uglyness/slowness I saw ...

@bf4 @jeremy