major bug fixes to branching and NOT expressions