Fix bugs for tests.