Fix an error in gates.