Fix bug with reseting dates when saving documents' states