Merge "Fix a concurrency bug that ends up in a crash."