Fixed issues in server gating code