Add expression tests and fix a few bugs.