Fix sort task bug