Save/restore state on config changes.