Fix a problem found by max. Refactor check_repo to be independent of Factory.