fix a bug in adding bool gate