Fix bugs in task list sorter