Avoid errors with trying to cancel task.