Simplify some redundant boolean expressions