Fix terminate condition.