Fixed writeConfig