fixed bug with writing the config file