Fix bitwise/logical OR problems
Avoid crash on NULL allocation
Fix mismatched parentheses
Merge pull request #103 from asmaloney/other-fixes

Fix bitwise/logical OR problems