Fixed race condition in test.