Fixed loading the config files.
Pulled from github and fixed code.