Improve and fix tests.