bug fix

fixed double saved times.
simplified code