Fix duration calculation