diff --git a/themes/DeepThought/sass/deep-thought.sass b/themes/DeepThought/sass/deep-thought.sass
index 5d32a1e86560263b8819fd08a03224280c9c76b8..05699cfe61071a914786017d6fe53c56dcae1bfd 100644
--- a/themes/DeepThought/sass/deep-thought.sass
+++ b/themes/DeepThought/sass/deep-thought.sass
@@ -525,13 +525,16 @@ body[theme="dark"]
 section
     flex: 1
 
-
 img[theme="dark"],
 picture[theme="dark"],
 video[theme="dark"],
 pre[theme="dark"]
     filter: invert(1) hue-rotate(180deg)
 
+.menu
+  position: sticky 
+  top: 48px
+
 #image-gay
   width: auto
   height: auto
diff --git a/themes/DeepThought/static/js/site.js b/themes/DeepThought/static/js/site.js
index cc195c030c213394e23e7a5eb02a5bd89e7fb635..0bab18a934341646ab964990da9e6ca026942dcd 100644
--- a/themes/DeepThought/static/js/site.js
+++ b/themes/DeepThought/static/js/site.js
@@ -11,8 +11,7 @@
 
   function isVisible(tocIndex) {
     const current = navSections[tocIndex];
-    const next = tocIndex < tocItems.length - 1 ? navSections[tocIndex + 1]
-      : document.querySelectorAll("section.section").item(1);
+    const next = tocIndex < tocItems.length - 1 ? navSections[tocIndex + 1] : document.querySelector("section.section").nextElementSibling;
 
     const c = current.getBoundingClientRect();
     const n = next.getBoundingClientRect();
diff --git a/themes/DeepThought/templates/page.html b/themes/DeepThought/templates/page.html
index effaf2533294e869cb4c2fa66b9b5115f42b6804..dc016891b9ee33ad6dbe6f8c56b6c5af905aedc5 100644
--- a/themes/DeepThought/templates/page.html
+++ b/themes/DeepThought/templates/page.html
@@ -45,7 +45,7 @@
       </div>
       {% if page.extra.toc %}
       <div class="column is-2 is-hidden-mobile">
-        <aside class="menu" style="position: sticky; top: 48px">
+        <aside class="menu">
           <p class="heading has-text-weight-bold">Contents</p>
           <ul class="menu-list">
             {% for h1 in page.toc %}