Fix a bug in nand simplification.