Fixed resource leak actually
Changed configuration loading