Fixed config loading so that's easier to migrate to OSGi.
Merge branch 'master' into osgi