Fix to ensure determineIndex() selects the correct frame when time is at min or max