Fixed lots of problems with tests.