fixed bug with reverse sort