Fix not gate bug