Bug fixes related to concurrency