Various unit test fixes