diff --git a/dev/demo/vcdemo.js b/dev/demo/vcdemo.js
index 0c66dd3..4e0eaed 100644
--- a/dev/demo/vcdemo.js
+++ b/dev/demo/vcdemo.js
@@ -122,32 +122,32 @@
 
     // Create a new virtual collection by passing a based json object and
     // field menu information
-    var vc = vcClass.create([
+    KorAP.vc = vcClass.create([
       ['title', 'string'],
       ['subTitle', 'string'],
       ['pubDate', 'date'],
       ['author', 'text']
     ]).fromJson(json);
 
-    document.getElementById('vc-view').appendChild(vc.element());
+    document.getElementById('vc-view').appendChild(KorAP.vc.element());
 
-    vc.open();
+    KorAP.vc.open();
 
     // show the current JSON serialization
     KorAP.showJSON = function () {
       var json = document.getElementById("json");
-      json.innerHTML = JSON.stringify(vc.root().toJson(), null, '  ');
+      json.innerHTML = JSON.stringify(KorAP.vc.root().toJson(), null, '  ');
       hljs.highlightBlock(json);
     };
 
     // show the current query serialization
     KorAP.showQuery = function () {
-      document.getElementById("query").innerHTML = vc.root().toQuery();
+      document.getElementById("query").innerHTML = KorAP.vc.root().toQuery();
     };
 
     // make the current vc persistant
     KorAP.makeVCPersistant = function () {
-      vc.makePersistant();
+      KorAP.vc.makePersistant();
     };
     
     //get the corpus statistic (demo function)
diff --git a/dev/js/spec/statSpec.js b/dev/js/spec/statSpec.js
index cb9d713..ec114eb 100644
--- a/dev/js/spec/statSpec.js
+++ b/dev/js/spec/statSpec.js
@@ -7,7 +7,7 @@
 
 
 define(['vc', 'vc/statistic', 'view/corpstatv'], function(vcClass, statClass, corpStatVClass){
-	 
+  
 	var json = {
    	"@type":"koral:docGroup",
    	"operation":"operation:or",
@@ -77,8 +77,81 @@
   	return cb(preDefinedStat);
   }; 
   
- 	
-	describe('KorAP.CorpusStat', function(){
+
+  generateCorpusDocGr = function(){     
+   let vc = vcClass.create().fromJson({
+      "@type" : 'koral:docGroup',
+      'operation' : 'operation:or',
+      'operands' : [
+        {
+          '@type' : 'koral:doc',
+          'key' : 'title', 
+          'match': 'match:eq',
+          'value' : 'Hello World!'
+        },
+        {
+          '@type' : 'koral:doc',   
+          'match': 'match:eq',
+          'key' : 'foo',
+          'value' : 'bar'
+        }
+      ]
+    });  
+   return vc;
+  }
+  
+  generateCorpusDoc = function(){
+    let vc= vcClass.create().fromJson({
+        '@type' : 'koral:doc',
+        'key' : 'title', 
+        'match': 'match:eq',
+        'value' : 'Hello World!',
+        'type'  : 'type:string'      
+    });
+    return vc;
+  };
+  
+  
+  /**
+   * Generate vc with docgroupref
+   */
+  generateCorpusRef = function(){  
+    let vc = vcClass.create().fromJson({
+      "@type" : "koral:docGroupRef",
+      "ref" : "@max/myCorpus"
+    });
+    return vc;
+  };
+  
+  
+  /**
+   * Checks is corpus statistic is active
+   */
+  checkStatActive = function(view, div){   
+    // corpus statistic exists, it is active and reloadStatButton is shown
+    if ((view.firstChild.classList.contains("stattable") === true) 
+      && (view.firstChild.classList.contains("greyOut") === false)
+      && (div.getElementsByClassName("reloadStatB").length == 0) ) { 
+      return true;
+    } 
+    return false;
+  };
+ 
+  
+  /**
+   * Checks if corpus statistic is disabled
+   */
+  checkStatDisabled = function(view, div){
+    if ((view.firstChild.classList.contains("stattable") === true) 
+        && (view.firstChild.classList.contains("greyOut") === true)
+        && (div.getElementsByClassName("reloadStatB").length === 1) ) {
+      return true;
+    }   
+    return false;
+    };
+    
+    
+  describe('KorAP.CorpusStat', function(){
 
 		it('should be initiable', function(){
 		  var stat = statClass.create(preDefinedStat);		
@@ -88,7 +161,7 @@
 		
 		it('should be parsed in a statistic view and displayed as HTML Description List', function(){
 		  var stat = statClass.create(preDefinedStat);		
-      var descL = stat.element();
+          var descL = stat.element();
 			expect(descL.tagName).toEqual('DL');		
 			expect(descL.children[0].tagName).toEqual('DIV');
 			expect(descL.children[0].children[0].tagName).toEqual('DT');
@@ -113,12 +186,14 @@
 	      ['author', 'text']
 	    ]).fromJson(json);
 
+		  KorAP.vc = vc;
+		  
 		  statView = corpStatVClass.create(vc);
-		  //corpStatVClass.show(vc);
+		  // corpStatVClass.show(vc);
 		  
 			var testDiv = document.createElement('div');
 			testDiv.appendChild(statView.show());
-			//statClass.showCorpStat(testDiv, vc);
+			// statClass.showCorpStat(testDiv, vc);
 			
 			expect(testDiv.children[0].tagName).toEqual('DIV');
 			expect(testDiv.children[0].getAttribute("class")).toEqual('stattable');   
@@ -232,5 +307,197 @@
       panel.lastChild.children[0].click();
       expect(panel.firstChild.children.length).toEqual(1);
     });
-  });		
+    
+   
+  });	
+	
+  
+  
+    /**
+     * Test disabling and reload of corpus statistic if vc is changed 
+     * in vc builder through user-interaction
+     */
+	describe ('KorAP.CorpusStat.Disable', function(){
+	
+	  /**
+	   * If the user defines a new vc, the statistic should be disabled,
+	   * because it is out-of-date.
+	   * 
+	   * The user can choose to display an up-to-date corpus statistic. Here it is tested
+	   * if corpus statistic is disabled after a valid change of corpus statistic and if the corpus statistic is updatable.
+	   */ 	  	 
+      it ('should disable the corpus statistic if corpus definition is changed and display a functional reload  button', function(){
+        
+        KorAP.vc = generateCorpusDocGr();  
+        
+        //Show corpus statistic
+        let show = document.createElement('div');
+        show.appendChild(KorAP.vc.element());
+        let panel = show.firstChild.lastChild.firstChild;
+        panel.lastChild.children[0].click();
+        let view = panel.firstChild.firstChild;
+        
+        //corpus statistic is active
+        expect(checkStatActive(view, show)).toBe(true);
+        
+        //change vc, a line in vc builder is deleted
+        KorAP._delete.apply(KorAP.vc.root().getOperand(0));
+        expect(checkStatDisabled(view,show)).toBe(true);
+        
+        //click at reload button
+        let rlbutton = show.getElementsByClassName("refresh").item(0);
+        rlbutton.click();
+        
+        expect(checkStatActive(view,show)).toBe(true);
+      });
+      
+      
+      it('should disable corpus statistic if entries in vc builder are deleted', function(){
+        KorAP.vc = generateCorpusDocGr();
+        
+        // create corpus builder and corpus statistic;
+        let show = document.createElement('div');
+        show.appendChild(KorAP.vc.element());   
+        let panel = show.firstChild.lastChild.firstChild;
+        panel.lastChild.children[0].click();
+        let view = panel.firstChild.firstChild;
+
+        expect(checkStatActive(view, show)).toBe(true);
+        
+        //delete foo=bar
+        KorAP._delete.apply(KorAP.vc.root().getOperand(1));
+        expect(checkStatDisabled(view, show)).toBe(true);
+       
+        //refresh corpus statistic
+        let rlbutton = show.getElementsByClassName("refresh").item(0);
+        rlbutton.click();
+        expect(checkStatActive(view,show)).toBe(true);   
+            
+        KorAP._delete.apply(KorAP.vc.root());
+        // fails momentarily, does not fail after next commit with Change-Id: Id44736f134c00e1a1be002bf14e00e6efa26ad02
+        //expect(checkStatDisabled(view, show)).toBe(true);        
+      });
+      
+      
+      it('should disable corpus statistic if key, matchoperator or value is changed', function(){  
+        /*         
+         * Doc change of key, match operator and value 
+         */
+        KorAP.vc= generateCorpusDoc();
+        // show vc builder and open corpus statistic
+        let show = document.createElement('div');
+        show.appendChild(KorAP.vc.element());
+        let panel = show.firstChild.lastChild.firstChild;
+        panel.lastChild.children[0].click();
+        let view = panel.firstChild.firstChild;
+        expect(checkStatActive(view, show)).toBe(true);
+        
+        KorAP.vc.root().matchop("ne").update();
+        expect(checkStatDisabled(view, show)).toBe(true);
+        
+        let rlbutton = show.getElementsByClassName("refresh").item(0);
+        rlbutton.click();
+        
+        view = panel.firstChild.firstChild;
+        expect(checkStatActive(view, show)).toBe(true);
+        KorAP.vc.root().value("Hello tester").update();
+        expect(checkStatDisabled(view, show)).toBe(true);
+          
+        //refresh corpus statistic
+        rlbutton = show.getElementsByClassName("refresh").item(0);
+        rlbutton.click();
+        view = panel.firstChild.firstChild;
+        expect(checkStatActive(view, show)).toBe(true);
+        
+        KorAP.vc.root().key("author").update();
+        expect(checkStatDisabled(view, show)).toBe(true);
+        
+        
+        /*
+         * DocGroupRef change of value...
+         */  
+        KorAP.vc = generateCorpusRef();
+        show = document.createElement('div');
+        show.appendChild(KorAP.vc.element());
+        panel = show.firstChild.lastChild.firstChild;
+        panel.lastChild.children[0].click();
+        view = panel.firstChild.firstChild;
+        expect(checkStatActive(view, show)).toBe(true);
+        
+        KorAP.vc.root().ref("@anton/secondCorpus").update();
+        expect(checkStatDisabled(view, show)).toBe(true);
+        });
+      
+      
+      it('should not disable corpus statistic if docgroup definition is incomplete', function(){
+        
+        KorAP.vc = generateCorpusDocGr();
+        
+        //Show corpus statistic
+        let show = document.createElement('div');
+        show.appendChild(KorAP.vc.element());
+        let panel = show.firstChild.lastChild.firstChild;
+        panel.lastChild.children[0].click();
+        let view = panel.firstChild.firstChild;
+        
+        expect(checkStatActive(view, show)).toBe(true);
+
+        KorAP._and.apply(KorAP.vc.root());
+
+        let andbuild = show.getElementsByClassName("builder");
+        expect(andbuild[0].firstChild.classList.contains('docGroup')).toBeTruthy();
+        expect(andbuild[0].firstChild.getAttribute("data-operation")).toEqual("and");  
+        expect(checkStatActive(view, show)).toBe(true);
+      });
+
+      
+      it('should not disable corpus statistic if doc/docref definition is incomplete', function(){
+        
+        /*
+         * DOC incomplete
+         */
+        KorAP.vc = vcClass.create().fromJson();
+        expect(KorAP.vc.builder().firstChild.classList.contains('unspecified')).toBeTruthy();
+        
+        // show vc builder and open corpus statistic
+        let show = document.createElement('div');
+        show.appendChild(KorAP.vc.element());
+        let panel = show.firstChild.lastChild.firstChild;
+        panel.lastChild.children[0].click();
+        let view = panel.firstChild.firstChild;
+       
+        // corpus statistic should be shown and be up-to-date, reload button is not shown
+        expect(checkStatActive(view, show)).toBe(true);
+        
+        // open the menu
+        KorAP.vc.builder().firstChild.firstChild.click();
+        KorAP._vcKeyMenu._prefix.add("author");
+        let prefElement = KorAP.vc.builder().querySelector('span.pref');
+        // add key 'author' to VC
+        prefElement.click();
+        
+        expect(checkStatActive(view, show)).toBe(true); 
+       
+        
+        /*
+         * DOCREF incomplete
+         */
+        KorAP.vc = vcClass.create().fromJson();
+        expect(KorAP.vc.builder().firstChild.classList.contains('unspecified')).toBeTruthy();
+        
+        // show vc builder and open corpus statistic
+        show = document.createElement('div');
+        show.appendChild(KorAP.vc.element());
+        panel = show.firstChild.lastChild.firstChild;
+        panel.lastChild.children[0].click();
+        view = panel.firstChild.firstChild;
+        expect(checkStatActive(view, show)).toBe(true);
+
+        KorAP.vc.builder().firstChild.firstChild.click();
+        KorAP._vcKeyMenu._prefix.add("referTo");
+        prefElement = KorAP.vc.builder().querySelector('span.pref');
+        prefElement.click();
+        expect(checkStatActive(view, show)).toBe(true);
+        });     
+      });
 });
diff --git a/dev/js/spec/vcSpec.js b/dev/js/spec/vcSpec.js
index f657ee9..e7cc4fb 100644
--- a/dev/js/spec/vcSpec.js
+++ b/dev/js/spec/vcSpec.js
@@ -27,7 +27,7 @@
 
   KorAP._vcKeyMenu = undefined;
 
-
+   
   // Helper method for building factories
   buildFactory = function (objClass, defaults) {
     return {
@@ -146,6 +146,7 @@
       expect(doc.key()).toBeUndefined();
       expect(doc.value()).toBeUndefined();
       expect(doc.type()).toEqual("string");
+      expect(doc.incomplete()).toBeTruthy();
     });
 
     it('should be definable', function () {
@@ -161,6 +162,7 @@
       expect(doc.key()).toEqual("title");
       expect(doc.type()).toEqual("string");
       expect(doc.value()).toEqual("Der alte Mann");
+      expect(doc.incomplete()).toBeFalsy();
     });
 
 
@@ -173,6 +175,7 @@
       expect(doc.key()).toEqual("author");
       expect(doc.type()).toEqual("string");
       expect(doc.value()).toEqual("Max Birkendale");
+      expect(doc.incomplete()).toBeFalsy();
 
       // No valid string
       doc = stringFactory.create({
@@ -195,6 +198,7 @@
       expect(doc.key()).toEqual("author");
       expect(doc.type()).toEqual("string");
       expect(doc.value()).toEqual("Max Birkendale");
+      expect(doc.incomplete()).toBeFalsy();
 
       // Invalid match type
       doc = stringFactory.create({
@@ -216,6 +220,7 @@
       });
       expect(doc.matchop()).toEqual('ne');
       expect(doc.rewrites()).toBeUndefined();
+      expect(doc.incomplete()).toBeFalsy();
 
       // Invalid matcher
       doc = regexFactory.create({
@@ -345,6 +350,12 @@
       doc = stringFactory.create();
       expect(doc.toQuery()).toEqual('author = "Max Birkendale"');
 
+      // Check for incompletion
+      expect(doc.incomplete()).toBeFalsy();
+      doc.value("");
+      expect(doc.incomplete()).toBeTruthy();
+      expect(doc.toQuery()).toEqual('');
+
       // Serialize string with quotes
       doc = stringFactory.create({ "value" : 'Max "Der Coole" Birkendate'});
       expect(doc.toQuery()).toEqual('author = "Max \\"Der Coole\\" Birkendate"');
@@ -570,6 +581,17 @@
           '(pubDate since 2014-05-12 & ' +
           'pubDate until 2014-12-05 & foo != /[a]?bar/)'
       );
+
+
+      // Check for incompletion and only serialize complete operands
+      expect(docGroup.incomplete()).toBeFalsy();
+      var op1 = docGroup.getOperand(0);
+      op1.value("");
+      expect(docGroup.incomplete()).toBeFalsy();
+      expect(docGroup.toQuery()).toEqual(
+        '(pubDate since 2014-05-12 & ' +
+          'pubDate until 2014-12-05 & foo != /[a]?bar/)'
+      );
     });
   });
 
@@ -625,6 +647,12 @@
       expect(vcRef.toQuery()).toEqual(
         "referTo \"@peter/myCorpus2\""
       );
+
+      // Check for incompletion and only serialize complete operands
+      expect(vcRef.incomplete()).toBeFalsy();
+      vcRef.ref("");
+      expect(vcRef.incomplete()).toBeTruthy();
+      expect(vcRef.toQuery()).toEqual("");
     });
   });
 
@@ -637,6 +665,7 @@
       expect(docElement.firstChild.firstChild.data).toEqual(KorAP.Locale.EMPTY);
       expect(docElement.lastChild.lastChild.data).toEqual(KorAP.Locale.EMPTY);
       expect(doc.toQuery()).toEqual('');
+      expect(doc.incomplete()).toBeTruthy();
 
       // Only removable
       expect(docElement.lastChild.children.length).toEqual(0);
@@ -731,7 +760,9 @@
     });
     
     it('should be replaceable on root', function () {
+      
       var vc = vcClass.create();
+      KorAP.vc = vc;
       expect(vc.toQuery()).toEqual("");
 
       expect(vc.root().ldType()).toEqual("non");
@@ -756,6 +787,8 @@
       var vc = vcClass.create([
         ["pubDate", "date"]
       ]);
+      KorAP.vc = vc;
+
       expect(vc.toQuery()).toEqual("");
       expect(vc.builder().firstChild.textContent).toEqual(KorAP.Locale.EMPTY);
       expect(vc.builder().firstChild.classList.contains('unspecified')).toEqual(true);
@@ -805,6 +838,7 @@
         "value":"Baum",
         "match":"match:eq"
       });
+      KorAP.vc = vc;
       expect(vc.toQuery()).toEqual("Titel = \"Baum\"");
 
       var vcE = vc.builder();
@@ -837,6 +871,7 @@
         "match":"match:eq"
       });
 
+      KorAP.vc = vc;
       expect(vc.toQuery()).toEqual("Titel = \"Baum\"");
 
       var vcE = vc.builder();
@@ -870,6 +905,7 @@
         "match":"match:eq"
       });
 
+      KorAP.vc = vc;
       expect(vc.toQuery()).toEqual("Titel = \"Baum\"");
 
       var vcE = vc.builder();
@@ -911,6 +947,7 @@
         ]
       });
 
+    KorAP.vc = vc;
       expect(vc.toQuery()).toEqual("author = \"Max Birkendale\" & pubDate in 2014-12-05");
 
       var vcE = vc.builder();
@@ -2936,29 +2973,32 @@
 
 
     it('should be clickable', function () {
-      var vc = vcClass.create([
+      KorAP.vc = vcClass.create([
         ['a', null],
         ['b', null],
         ['c', null]
       ]).fromJson();
-      expect(vc.builder().firstChild.classList.contains('unspecified')).toBeTruthy();
+      
+      //vc = KorAP.vc;
+      
+      expect(KorAP.vc.builder().firstChild.classList.contains('unspecified')).toBeTruthy();
 
       // This should open up the menu
-      vc.builder().firstChild.firstChild.click();
-      expect(vc.builder().firstChild.firstChild.tagName).toEqual('UL');
+      KorAP.vc.builder().firstChild.firstChild.click();
+      expect(KorAP.vc.builder().firstChild.firstChild.tagName).toEqual('UL');
 
       KorAP._vcKeyMenu._prefix.clear();
       KorAP._vcKeyMenu._prefix.add('x');
 
-      var prefElement = vc.builder().querySelector('span.pref');
+      var prefElement = KorAP.vc.builder().querySelector('span.pref');
       expect(prefElement.innerText).toEqual('x');
 
       // This should add key 'x' to VC
       prefElement.click();
 
-      expect(vc.builder().firstChild.classList.contains('doc')).toBeTruthy();
-      expect(vc.builder().firstChild.firstChild.className).toEqual('key');
-      expect(vc.builder().firstChild.firstChild.innerText).toEqual('x');
+      expect(KorAP.vc.builder().firstChild.classList.contains('doc')).toBeTruthy();
+      expect(KorAP.vc.builder().firstChild.firstChild.className).toEqual('key');
+      expect(KorAP.vc.builder().firstChild.firstChild.innerText).toEqual('x');
     });
   });
 
diff --git a/dev/js/src/panel/vcpanel.js b/dev/js/src/panel/vcpanel.js
index 98a9b4b..e12c20c 100644
--- a/dev/js/src/panel/vcpanel.js
+++ b/dev/js/src/panel/vcpanel.js
@@ -43,10 +43,19 @@
       if (this.statView === undefined || !this.statView.shown()) {
         this.statView = corpStatVClass.create(this.vc, this);
         this.add(this.statView);
+        this.vc.oldvcQuery = KorAP.vc.toQuery();
       }
 
     },
     
+    /**
+     * Reload corpus statistic 
+     *
+     */
+    reloadCorpStat: function(){
+      this.statView.close();
+      this.addCorpStat();
+    }
     
   }
 });
diff --git a/dev/js/src/vc.js b/dev/js/src/vc.js
index 711008f..0431f92 100644
--- a/dev/js/src/vc.js
+++ b/dev/js/src/vc.js
@@ -81,6 +81,8 @@
   // KorAP._validDateMatchRE is defined in datepicker.js!
 
   const loc = KorAP.Locale;
+  loc.SHOW_STAT        = loc.SHOW_STAT        || 'Statistics';
+  loc.VERB_SHOWSTAT    = loc.VERB_SHOWSTAT    || 'Corpus Statistics';
   loc.VC_allCorpora    = loc.VC_allCorpora    || 'all corpora';
   loc.VC_oneCollection = loc.VC_oneCollection || 'a virtual corpus';
   loc.MINIMIZE         = loc.MINIMIZE         || 'Minimize';
@@ -360,13 +362,12 @@
     
     /**
      * Update the whole object based on the underlying data structure
-     */ 
+     */    
     update : function() {
       this._root.update();
+      this.checkGrayingStat();
       return this;
     },
-    
- 
     /**
      * Make the vc persistant by injecting the current timestamp as a
      * creation date limit criterion.
@@ -478,8 +479,17 @@
       //Create panel  
       this.panel = vcPanelClass.create(this); 
       dv.appendChild(this.panel.element());
+      
     },
     
-    
+    /**
+     * Checks if corpus statistic has to be greyOut,
+     * and to be updated after clicking at the "reload-button"
+     */
+    checkGrayingStat : function(){
+      if(this.panel !== undefined && this.panel.statView !==undefined){
+        this.panel.statView.checkGrayingStatistic();
+      }
+    }
   };
 });
diff --git a/dev/js/src/vc/doc.js b/dev/js/src/vc/doc.js
index 996c347..2a0e872 100644
--- a/dev/js/src/vc/doc.js
+++ b/dev/js/src/vc/doc.js
@@ -149,6 +149,10 @@
         e.appendChild(op.element());
       };
       
+      if(KorAP.vc){
+        KorAP.vc.checkGrayingStat();
+      }
+      
       return e;
     },
 
@@ -616,9 +620,12 @@
       };
     },
 
+    incomplete : function () {
+      return !(this.matchop() && this.key() && this.value());
+    },
 
     toQuery : function () {
-      if (!this.matchop() || !this.key())
+      if (this.incomplete())
         return "";
 
       // Build doc string based on key
diff --git a/dev/js/src/vc/docgroup.js b/dev/js/src/vc/docgroup.js
index 7ce2fed..10a6495 100644
--- a/dev/js/src/vc/docgroup.js
+++ b/dev/js/src/vc/docgroup.js
@@ -356,7 +356,7 @@
     toQuery : function (brackets) {
       var list = this._operands
 	        .filter(function (op) {
-	          return op.ldType() !== 'non';
+            return !op.incomplete();
 	        })
 	        .map(function (op) {
 	          return (op.ldType() === 'docGroup') ?
diff --git a/dev/js/src/vc/docgroupref.js b/dev/js/src/vc/docgroupref.js
index 7d3ecea..fa82a4b 100644
--- a/dev/js/src/vc/docgroupref.js
+++ b/dev/js/src/vc/docgroupref.js
@@ -109,7 +109,7 @@
         // Append new operators
         e.appendChild(op.element());
       };  
-
+      KorAP.vc.checkGrayingStat();
       return this.element();
     },
 
@@ -207,7 +207,6 @@
       return this;
     },
 
-
     /**
      * Click on the unspecified object
      */
@@ -261,9 +260,13 @@
       };
     },
 
+
+    incomplete : function () {
+      return this.ref() ? false : true
+    },
     
     toQuery : function () {
-      if (!this.ref())
+      if (this.incomplete())
         return "";
 
       // Build doc string based on key
diff --git a/dev/js/src/vc/jsonld.js b/dev/js/src/vc/jsonld.js
index 600a5bb..21260d4 100644
--- a/dev/js/src/vc/jsonld.js
+++ b/dev/js/src/vc/jsonld.js
@@ -99,6 +99,10 @@
       return null;
     },
 
+    incomplete : function () {
+      return false;
+    },
+
     toQuery : function () {
       return '';
     }
diff --git a/dev/js/src/vc/unspecified.js b/dev/js/src/vc/unspecified.js
index 6ffa0e3..416ad85 100644
--- a/dev/js/src/vc/unspecified.js
+++ b/dev/js/src/vc/unspecified.js
@@ -121,6 +121,11 @@
       return this._element;
     },
 
+
+    incomplete : function () {
+      return true;
+    },
+    
     /**
      * Click on the unspecified object
      */
diff --git a/dev/js/src/view/corpstatv.js b/dev/js/src/view/corpstatv.js
index 1cc6f0c..44a9ae2 100644
--- a/dev/js/src/view/corpstatv.js
+++ b/dev/js/src/view/corpstatv.js
@@ -3,18 +3,20 @@
  * 
  * @author Helge Stallkamp
  */
+
 define([ 'view', 'vc/statistic' ], function(viewClass, statClass) {
 
   const d = document;
 
   return {
-    create : function(vc) {
+    create : function(vc, panel) {
       return Object.create(viewClass)._init([ 'vcstatistic' ]).upgradeTo(this)
-          ._init(vc);
+          ._init(vc, panel);
     },
 
-    _init : function(vc) {
+    _init : function(vc, panel) {
       this.vc = vc;
+      this.panel = panel;
       return this;
     },
 
@@ -71,9 +73,10 @@
      * Show corpus statistic view 
      */
     show : function() {
+      
       if (this._show)
-        return this._show;
-
+        return this._show; 
+      
       var statTable = document.createElement('div');
       statTable.classList.add('stattable', 'loading');
   
@@ -91,13 +94,70 @@
 
         statisticobj = statClass.create(statistic);
         statTable.appendChild(statisticobj.element());
+    
       });
 
       this._show = statTable;
       return statTable;
 
     },
+    
 
+    
+    /**
+     * Checks if graying necessary
+     */
+    checkGrayingStatistic : function (){   
+     var newString = KorAP.vc.toQuery();
+     var oldString = this.vc.oldvcQuery;
+     
+     /*
+      * Do ignore surrounding round brackets
+      * Definining an incomplete docGroup in the vc builder: 
+      * (foo = bar and author = Goethe) and ... 
+      * leads to 
+      * vc.toQuery() -> (foo = bar and author=Goethe)
+      */
+     if(newString.startsWith('(')){
+       newString = newString.slice(1, newString.length-1);
+     }
+     
+      if(newString && newString != oldString) {
+        this.grayingStat();
+      }   
+   },
+   
+    /**
+     * Graying corpus statistic if in vc builder a different vc is choosen.
+     * After clicking at the reload-button the up-to-date corpus statistic is displayed.
+     */   
+    grayingStat : function(){
+      var statt = this._show;
+      
+      if(statt.getElementsByClassName('reloadStatB').length == 0){
+          var reloadspan = document.createElement('span');
+          reloadspan.classList.add('reloadStatB');
+          reloadb = reloadspan.addE('span');
+          reloadb.classList.add('refresh');
+          
+          var that = this;
+          
+          reloadb.addEventListener("click", function (e){    
+          statt.classList.remove('greyOut');
+          that.panel.actions.element().querySelector(".statistic").classList.remove('greyOut');
+          that.panel.reloadCorpStat(); 
+             });
+          
+ 
+        statt.appendChild(reloadspan);
+        statt.classList.add('greyOut');        
+        this.panel.actions.element().querySelector(".statistic").classList.add('greyOut');
+        
+        console.log("Corpus statistic DISABLED");
+        }
+    },
+
+    
     /**
      * Close the view.
      */
