fix some bug in boolgate method