More fixes and some corrected unit tests.