Fix the wait condition, no need to wait when already done or cancelled