Fix problems with repository creation and Python 2.x compatibility