duration calculation bug fixed