Fixed KQ view to correctly update session

Change-Id: I045455ec2a03f35e58a2de5d32e69d6fa6ea3919
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index 8e42b4e..4f8c41f 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -271,31 +271,7 @@
             view.appendChild(vc.element());
 
           vc.open();
-        }
-
-        /*
-        // The vc is visible
-        if (vcname.classList.contains('active')) {
-
-          // view.removeChild(vc.element());
-          vc.minimize();
-          vcname.classList.remove('active');
-          delete show['collection'];
-        }
-
-        // The vc is not visible yet
-        else {
-
-          // Spawn the element for the first time
-          var view = d.getElementById('vc-view');
-          if (!view.firstChild)
-            view.appendChild(vc.element());
-
-          vc.open();
-          vcname.classList.add('active');
-          show['collection'] = true;
         };
-        */
       };
 
       vcname.onclick = vcclick;
diff --git a/dev/js/src/panel/result.js b/dev/js/src/panel/result.js
index a572180..978a1b6 100644
--- a/dev/js/src/panel/result.js
+++ b/dev/js/src/panel/result.js
@@ -45,8 +45,8 @@
 
         // On close, remove session info on KQ
         this._kq.onClose = function () {
-          this._opened['kq'] = undefined;
-        };
+          delete this._opened['kq'];
+        }.bind(this);
 
         this._opened['kq'] = true;
         this.add(this._kq);
diff --git a/dev/js/src/view.js b/dev/js/src/view.js
index 2f35c9e..4885afa 100644
--- a/dev/js/src/view.js
+++ b/dev/js/src/view.js
@@ -6,8 +6,7 @@
 define(['buttongroup', 'util'], function (buttonGroupClass) {
 
   const loc = KorAP.Locale;
-  loc.CLOSE = loc.CLOSE     || 'Close';
-  
+  loc.CLOSE = loc.CLOSE     || 'Close';  
 
   return {
     create : function (classes) {
diff --git a/dev/js/src/view/result/koralquery.js b/dev/js/src/view/result/koralquery.js
index 583b196..6060bb8 100644
--- a/dev/js/src/view/result/koralquery.js
+++ b/dev/js/src/view/result/koralquery.js
@@ -18,7 +18,7 @@
       kq.setAttribute('id', 'koralquery');
 
       var kqInner = kq.addE('div');
-      kqInner.innerHTML = JSON.stringify(KorAP.koralQuery, null, '  ');
+      kqInner.innerHTML = JSON.stringify(KorAP.koralQuery || {}, null, '  ');
 
       // Highlight the view
       hljs.highlightBlock(kqInner);