Fix the last note duration detection.