Fixed bug that would not write the config file correctly at startup.