fix race condition in _fetchrepo