   func expand(variable  variable:String, value:String, prefix:Int?) -> String {
     if let prefix = prefix {
       if value.characters.count > prefix {
-        let index = advance(value.startIndex, prefix)
+        let index = value.startIndex.advancedBy(prefix, limit: value.endIndex)
         return expand(value: value.substringToIndex(index))
       }
     }


  override func expand(variable  variable:String, value:[AnyObject], explode:Bool) -> String? {
    let joiner = explode ? self.joiner : ","
    let expandedValue = joiner.join(value.map {
      let expandedValue = self.expand(value: "\($0)")

      if explode {

        }

        return expandedValue
      }.joinWithSeparator(joiner)

      if !explode {
        return "\(variable)=\(expandedValue)"
