Fixes to tests, some new tests.