fix bug in polytope gating