Fix bugs in tests.