Fixed concurrency bugs in integrationtests.