Improve robustness in creating repodir