fixed error in total time calculation