diff --git a/spatial/static/spatial/js/gridmap.js b/spatial/static/spatial/js/gridmap.js
index af00dc7b2d5595fdb81f83761eea66351e28bde6..905db6313f05d03ef1951ea82ff29e4ad8d07fdc 100644
--- a/spatial/static/spatial/js/gridmap.js
+++ b/spatial/static/spatial/js/gridmap.js
@@ -179,6 +179,7 @@ async function initGridMap(inputModelId, wmsURL, year, mapAttribution) {
         map.setTarget(null);
     }
     WMSLayersDateBucket = {};
+    layers = [];
     timestamps = undefined;
     todayLayerIndex = undefined;
     document.getElementById("paramselector").style.display="block";
@@ -388,7 +389,7 @@ async function initGridMap(inputModelId, wmsURL, year, mapAttribution) {
         }
 
         popup = new ol.Overlay({
-        element: document.getElementById('popup')
+            element: document.getElementById('popup')
         });
         map.addOverlay(popup);
 
@@ -396,6 +397,7 @@ async function initGridMap(inputModelId, wmsURL, year, mapAttribution) {
             displayQueryResult(evt);
         });
 
+
         // Store user's zoom/pan preferences for the next browser session
         map.on('moveend', (evt) => {
             // Store map settings