Cleanup and fix tests.