Fixed error resulting from date comparison sorting.
Merged