fix race condition in test