Fixed writing of config file