fixed calcDuration bug