Fixed error in remove_gate