Fixing some marginal concurrency bugs.