fix concurrency deadlocks