Remove race condition in test.