fix race condition in tests