Calculating chat duration, bug fix