Fixed race condition in unit test?