fix the fix for the bug when reverse sorting is set. in the right place this time.