Avoid a race condition in tests