fixed date conversion bug when saving state.