Fix unit test crash