fixed bug in sort by date