+diff --git a/UnitTests/HttpInterface/api-cursor-spec.rb b/UnitTests/HttpInterface/api-cursor-spec.rb
+index 7247152..493af19 100644
+--- a/UnitTests/HttpInterface/api-cursor-spec.rb
++++ b/UnitTests/HttpInterface/api-cursor-spec.rb
+@@ -170,6 +170,42 @@ describe ArangoDB do
+ 	doc.parsed_response['code'].should eq(400)
+       end
+ 
++      it "creates a cursor and deletes it in the middle" do
++	cmd = api
++	body = "{ \"query\" : \"FOR u IN #{@cn} LIMIT 5 RETURN u.n\", \"count\" : true, \"batchSize\" : 2 }"
++	doc = ArangoDB.log_post("#{prefix}-create-for-limit-return", cmd, :body => body)
++	
++	doc.code.should eq(201)
++	doc.headers['content-type'].should eq("application/json")
++	doc.parsed_response['error'].should eq(false)
++	doc.parsed_response['code'].should eq(201)
++	doc.parsed_response['id'].should be_kind_of(Integer)
++	doc.parsed_response['hasMore'].should eq(true)
++	doc.parsed_response['count'].should eq(5)
++	doc.parsed_response['result'].length.should eq(2)
++
++	id = doc.parsed_response['id']
++
++	cmd = api + "/#{id}"
++	doc = ArangoDB.log_put("#{prefix}-create-for-limit-return-cont", cmd)
++	
++	doc.code.should eq(200)
++	doc.headers['content-type'].should eq("application/json")
++	doc.parsed_response['error'].should eq(false)
++	doc.parsed_response['code'].should eq(200)
++	doc.parsed_response['hasMore'].should eq(true)
++	doc.parsed_response['count'].should eq(5)
++	doc.parsed_response['result'].length.should eq(2)
++
++	cmd = api + "/#{id}"
++	doc = ArangoDB.log_delete("#{prefix}-delete", cmd)
++
++	doc.code.should eq(202)
++	doc.headers['content-type'].should eq("application/json")
++	doc.parsed_response['error'].should eq(false)
++	doc.parsed_response['code'].should eq(202)
++      end
++
+       it "deleting a cursor" do
+ 	cmd = api
+ 	body = "{ \"query\" : \"FOR u IN #{@cn} LIMIT 5 RETURN u.n\", \"count\" : true, \"batchSize\" : 2 }"
+@@ -194,6 +230,51 @@ describe ArangoDB do
+ 	doc.parsed_response['error'].should eq(false)
+ 	doc.parsed_response['code'].should eq(202)
+       end
++
++      it "deleting a deleted cursor" do
++	cmd = api
++	body = "{ \"query\" : \"FOR u IN #{@cn} LIMIT 5 RETURN u.n\", \"count\" : true, \"batchSize\" : 2 }"
++	doc = ArangoDB.post(cmd, :body => body)
++	
++	doc.code.should eq(201)
++	doc.headers['content-type'].should eq("application/json")
++	doc.parsed_response['error'].should eq(false)
++	doc.parsed_response['code'].should eq(201)
++	doc.parsed_response['id'].should be_kind_of(Integer)
++	doc.parsed_response['hasMore'].should eq(true)
++	doc.parsed_response['count'].should eq(5)
++	doc.parsed_response['result'].length.should eq(2)
++
++	id = doc.parsed_response['id']
++
++	cmd = api + "/#{id}"
++	doc = ArangoDB.log_delete("#{prefix}-delete", cmd)
++
++	doc.code.should eq(202)
++	doc.headers['content-type'].should eq("application/json")
++	doc.parsed_response['error'].should eq(false)
++	doc.parsed_response['code'].should eq(202)
++	
++        doc = ArangoDB.log_delete("#{prefix}-delete", cmd)
++
++	doc.code.should eq(400)
++	doc.headers['content-type'].should eq("application/json")
++	doc.parsed_response['error'].should eq(true)
++	doc.parsed_response['errorNum'].should eq(1600);
++	doc.parsed_response['code'].should eq(400)
++      end
++
++      it "deleting an invalid cursor" do
++	cmd = api
++	cmd = api + "/999999" # we assume this cursor id is invalid
++	doc = ArangoDB.log_delete("#{prefix}-delete", cmd)
++
++	doc.code.should eq(400)
++	doc.headers['content-type'].should eq("application/json")
++	doc.parsed_response['error'].should eq(true);
++	doc.parsed_response['errorNum'].should eq(1600);
++	doc.parsed_response['code'].should eq(400)
++      end
+     end
+ 
+ ################################################################################
 diff --git a/arangod/V8Server/ApplicationV8.cpp b/arangod/V8Server/ApplicationV8.cpp
-index e1b246d..c381f4e 100644
+index d200d55..c65fa15 100644
 --- a/arangod/V8Server/ApplicationV8.cpp
 +++ b/arangod/V8Server/ApplicationV8.cpp
 @@ -1,5 +1,5 @@

   LOGGER_TRACE << "initialised V8 context #" << i;
 
diff --git a/arangod/V8Server/ApplicationV8.h b/arangod/V8Server/ApplicationV8.h
index a4fa6bd..e91304d 100644
--- a/arangod/V8Server/ApplicationV8.h
+++ b/arangod/V8Server/ApplicationV8.h
@@ -91,7 +91,19 @@ namespace triagens {

   };
 
 }
@@ -106,6 +135,7 @@ ApplicationV8::ApplicationV8 (string const& binaryPath)
     _startupModules("js/modules"),
     _actionPath(),
     _gcInterval(1000),
+    _gcFrequency(10.0),
     _startupLoader(),
     _actionLoader(),
     _vocbase(0),
@@ -230,21 +260,30 @@ ApplicationV8::V8Context* ApplicationV8::enterContext () {
 ////////////////////////////////////////////////////////////////////////////////
 
 void ApplicationV8::exitContext (V8Context* context) {
