read and write configuration file