Improved configuration loading and fixed NPE.