     if aMakeData
       @_makeData = aMakeData
     else
-      @_makeData = if aOptions.keys isnt false and aOptions.values isnt false then (key, value) ->
+      @_makeData = if @_options.keys isnt false and @_options.values isnt false then (key, value) ->
           key: key
           value: value
-      else if aOptions.values is false then (key) -> key
-      else if aOptions.keys   is false then (_, value) -> value
+      else if @_options.values is false then (key) -> key
+      else if @_options.keys   is false then (_, value) -> value
       else ->
     if db
       if !db.isOpen or db.isOpen()

inherits      = util.inherits
isFunction    = util.isFunction
isObject      = util.isObject

FILTER_INCLUDED = consts.FILTER_INCLUDED
FILTER_EXCLUDED = consts.FILTER_EXCLUDED
FILTER_STOPPED  = consts.FILTER_STOPPED
EncodingError   = Errors.EncodingError

###
readStream is used to search and read the [abstract-nosql](https://github.com/snowyu/abstract-nosql) database.

module.exports = class ReadStream
  inherits ReadStream, Readable

  constructor: (db, aOptions, aMakeData)->
    if (!(this instanceof ReadStream))
      return new ReadStream(db, aOptions, aMakeData)

    @_options = extend({}, defaultOptions)
    @_options = extend(@_options, aOptions || {})
    Readable.call(this, { objectMode: true, highWaterMark: @_options.highWaterMark })

    @_waiting = false
    db = aOptions.db unless db?
    if isFunction(@_options.filter)
      @_filter = (item)->
        vKey = vValue = null
        if isObject(item)
