diff --git a/misc/tableheader.js b/misc/tableheader.js
index 9d05e23..2d5a666 100644
--- a/misc/tableheader.js
+++ b/misc/tableheader.js
@@ -68,7 +68,7 @@ Drupal.behaviors.tableHeader = function (context) {
     // Check the previous anchor to see if we need to scroll to make room for the header.
     // Get the height of the header table and scroll up that amount.
     if (prevAnchor != location.hash) {
-      if (location.hash != '') {
+      if (location.hash != '' && $('td' + location.hash).size()) {
         var offset = $('td' + location.hash).offset();
         if (offset) {
           var top = offset.top;
