fixed critical concurrency issues with RepositoryConnection