Fix some bugs with tests.