Minor fix to marking tasks after sorting.

Marking tasks will now sort tasks by position before marking.
Merge remote-tracking branch 'origin/master' into yongkai