updated startDuration and endDuration functions

An exception when endDuration is before the startDuration solved.