Fix some obvious errors

A lot of tests were failing with obvious NPE's as a result of bad
merging. After this fix, most test failures are non-errors (i.e.
calculating 2+3=8 instead of just blowing up).