fixed test race condition