fix several concurrency related deadlocks