fix bug with time not saving correctly