fix #4260 & #3194: sort and resort problems

This fixes:
- #4260: sort by distance doesn't work
- #3914: resorting of event lists doesn't work