Fixed concurrency issue with getting the provider for the pool.