fix sorting issue in tasks