Bug fixes for unit tests.