         aSeperator = PATH_SEP + aSeperator
     else if keyIsStr
       #try to find the separator on the key
-      i = SUBKEY_SEPS[0].indexOf(key[0], 1)
+      i = SUBKEY_SEPS[0].indexOf(aKey[0], 1)
       if i > 0
           vSeperator = PATH_SEP + SUBKEY_SEPS[1][i]
-          key = key.substring(1)
+          aKey = aKey.substring(1)
     #console.log("codec.encode:",path.join(e[0]) + vSeperator + key)
     #TODO: I should encode with path.join(e[0], vSeperator + key)) simply in V8.
     #      all separators are same now.

  @decodeKey: decodeKey = (key, keyEncoding, options)->
    #v=[parent, key, separator, realSeparator]
    #realSeparator is optional only opts.separator && opts.separator != realSeparator
    v = decode(key, options && options.separator)
    vSep = v[2] #separator
    vSep = PATH_SEP unless vSep?  #if the precodec is other codec.
    key = if keyEncoding then keyEncoding.decode(v[1], options) else v[1]

      aPath = ""
    else
      aPath = PATH_SEP
    aPath + aSeperator + aKey

  #return [path, key, separator, realSeparator]
  #the realSeparator is optional, only (aSeparator && aSeparator !== seperator
