Unittest fixes

These commits fix up some of the failing unit tests.