Sort by distance don't work

fix #4260