 						
 						newSegment += String(char)
 						
-						if charIndex == segment.characters.count - 1 {
+						if charIndex == segment.count - 1 {
 							skipNextNewLineReplacement = true
 						}
 						

		let timescale = Int32(framerate * 1000)
		let value = Int64(Double(timescale) * totalSeconds)
		
		let totalSecondsCMTime = CMTimeMake(value, timescale)
		
		return totalSecondsCMTime
	}

	public func CMTime(fromFCPXMLTime timeString: String) -> CMTime {
		var timeValues = timeString.components(separatedBy: "/")
		if timeValues.count > 1 {
			timeValues[1] = String(timeValues[1].dropLast())
			let value = Int64(timeValues[0])!
			let timescale = Int32(timeValues[1])!
			
			return CMTimeMake(value: value, timescale: timescale)
		} else {
			timeValues[0] = String(timeValues[0].dropLast())
			let value = Int64(timeValues[0])!
			
			return CMTimeMake(value: value, timescale: 1)
		}
	}
	
