Fixed the date save function