Fix gating codes