Fix writting settings to file