fix duration calculation