fixed race condition in unit test