Fix include
Rewrite find_repository() in a more safe way