Fix unit test hangs