Fix bug with loading versions and making code more robust