fix bug where back button does not save