fix test race condition