fix the check if task has returned a failed status