update and clean up prefs