fixes concurrency issues and bugs in the test harness