  
      // skip from the beginning
      if (0 < skip) {
-@@ -1291,6 +1301,7 @@ static v8::Handle<v8::Value> JS_AllQuery (v8::Arguments const& argv) {
+@@ -1291,6 +1329,7 @@ static v8::Handle<v8::Value> JS_AllQuery (v8::Arguments const& argv) {
        }
      }
  

 
   // generate result
   if (mptr._did != 0) {
@@ -415,12 +419,14 @@ bool RestDocumentHandler::readSingleDocument (bool generateBody) {
   // inside read transaction
   // .............................................................................
 
-  _documentCollection->beginRead(_documentCollection);
+  int lockResult = _documentCollection->beginRead(_documentCollection);
+  LOGGER_TRACE << "result of beginRead: " << lockResult;
 
   TRI_voc_cid_t cid = _documentCollection->base._cid;
   TRI_doc_mptr_t const document = findDocument(did);
 
   _documentCollection->endRead(_documentCollection);
+  LOGGER_TRACE << "endRead";
 
   // .............................................................................
   // outside read transaction
@@ -511,7 +517,8 @@ bool RestDocumentHandler::readAllDocuments () {
 
   vector<TRI_voc_did_t> ids;
 
-  _documentCollection->beginRead(_documentCollection);
+  int lockResult = _documentCollection->beginRead(_documentCollection);
+  LOGGER_TRACE << "result of beginRead: " << lockResult;
 
   TRI_voc_cid_t cid = _documentCollection->base._cid;
 
@@ -538,6 +545,7 @@ bool RestDocumentHandler::readAllDocuments () {
   }
   
   _documentCollection->endRead(_documentCollection);
+  LOGGER_TRACE << "endRead";
 
   // .............................................................................
   // outside read transaction
@@ -715,7 +723,8 @@ bool RestDocumentHandler::updateDocument () {
   // inside write transaction
   // .............................................................................
 
-  _documentCollection->beginWrite(_documentCollection);
+  int lockResult = _documentCollection->beginWrite(_documentCollection);
+  LOGGER_TRACE << "result of beginWrite: " << lockResult;
 
   // unlocking is performed in updateJson()
   TRI_voc_rid_t rid = 0;
@@ -860,7 +869,8 @@ bool RestDocumentHandler::deleteDocument () {
   // inside write transaction
   // .............................................................................
 
-  _documentCollection->beginWrite(_documentCollection);
+  int lockResult = _documentCollection->beginWrite(_documentCollection);
+  LOGGER_TRACE << "result of beginWrite: " << lockResult;
 
   TRI_voc_rid_t rid = 0;
   TRI_voc_cid_t cid = _documentCollection->base._cid;
diff --git a/arangod/V8Server/ApplicationV8.cpp b/arangod/V8Server/ApplicationV8.cpp
index d200d55..80185d3 100644
--- a/arangod/V8Server/ApplicationV8.cpp

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