 +  public:
 +    AhuacatlContextGuard (TRI_vocbase_t* vocbase, const string& query) : 
 +      _context(0) {
++      LOGGER_DEBUG << "context guard created";
 +      _context = TRI_CreateContextAql(vocbase, query.c_str());
++  
++      if (_context == 0) {
++        LOGGER_DEBUG << "failed to create context for query %s" << query;
++      }
 +    }
 +
 +    ~AhuacatlContextGuard () {
 +      this->free();
++      LOGGER_DEBUG << "context guard destroyed";
 +    }
 +
 +    void free () {

 
   if (tryCatch.HasCaught()) {
     if (tryCatch.Exception()->IsObject() && v8::Handle<v8::Array>::Cast(tryCatch.Exception())->HasOwnProperty(v8::String::New("errorNum"))) {
@@ -1906,17 +1988,16 @@ static v8::Handle<v8::Value> JS_ParseAhuacatl (v8::Arguments const& argv) {
   }
   string queryString = TRI_ObjectToString(queryArg);
 

 
     return scope.Close(v8::ThrowException(errorObject));
   }
@@ -1927,11 +2024,10 @@ static v8::Handle<v8::Value> JS_ParseAhuacatl (v8::Arguments const& argv) {
   result->Set(v8::String::New("parsed"), v8::True());
 
   // return the bind parameter names
