Fix 'undefined variable task' error in gate.