Fix error handling of track length computation (used by the previous commit).