     done = true
     if response.statusCode != 200
       error = new errors.RetsServerError(methodName, response.statusCode, response.statusMessage, response.rawHeaders)
-      debug "RETS #{methodName} (streaming) error: #{error.message}"
+      debug("RETS #{methodName} (streaming) error: #{error.message}")
       failCallback(error)
     else if responseCallback
       responseCallback(response)

    if done
      return
    done = true
    debug "RETS #{methodName} (streaming) error:", error
    failCallback(error)
  responseHandler = (response) ->
    if done

  Promise.try () ->
    retsSession(qs: queryOptions)
  .catch (error) ->
    debug("RETS #{methodName} error:", error)
    Promise.reject(error)
  .spread (response, body) ->
    if response.statusCode != 200
      error = new errors.RetsServerError(methodName, response.statusCode, response.statusMessage, response.rawHeaders)
      debug("RETS #{methodName} error: #{error.message}")
      return Promise.reject(error)
    body: body
    response: response
