Fixed some memory leaks when loading the config file