         
         beginEditing()
         
-        currentString.replaceCharactersInRange(range, withString: str + listItemFillText)
-        edited(.EditedCharacters, range: range, changeInLength: (str.characters.count + listItemFillText.characters.count) - range.length)
+        let finalStr: NSString = "\(str)\(listItemFillText)"
+        
+        currentString.replaceCharactersInRange(range, withString: String(finalStr))
+        edited(.EditedCharacters, range: range, changeInLength: (finalStr.length - range.length))
         
         endEditing()
         
         // Selected range changed.
         if listItemFillText != "" {
-            let selectedRangeLocation = textView.selectedRange.location + listItemFillText.characters.count
+            let selectedRangeLocation = textView.selectedRange.location + listItemFillText.length
             
             textView.selectedRange = NSRange(location: selectedRangeLocation, length: textView.selectedRange.length)
             

    }
    
    override func replaceCharactersInRange(range: NSRange, withString str: String) {
        var listItemFillText: String = ""
        var currentNumber: Int?
        
        // Unordered and Ordered list auto-complete support

//                // Reorder numbers after current line.
//                var afterStrings = textView.text.substringFromIndex(textView.text.startIndex.advancedBy(textView.selectedRange.location))
//                
//                let orderedListAfterItemsMatches = NCKTextUtil.markdownOrderedListAfterItemsRegularExpression.matchesInString(afterStrings, options: [], range: NSRange(location: 0, length: NSString(string: afterStrings).length))
//                
//                for orderedListAfterItem in orderedListAfterItemsMatches {
//                    currentNumber! += 1
