Sort by distance don't work

fix #4260: sort by distance doesn't work
If this constructor is really needed, it should be private.