fixing concurrency issues in tests