Sort by distance don't work

fix #4260: sort by distance doesn't work
Ok.