fix race condition with tests