Fix boolean precendence problem. Closes #1302.