duration calculation fix