Fix duration calculation after refactoring.