Fixes

Merge in some fixes (mainly to the failing unit tests)