diff --git a/scripts/titlemd_test.py b/scripts/titlemd_test.py
index 7f473ba2e78803005eb63ffd465dd003b36fb8f7..49287c0ec98e78539157fdb4a8b27b1b550616a9 100755
--- a/scripts/titlemd_test.py
+++ b/scripts/titlemd_test.py
@@ -26,7 +26,7 @@ def main(location):
       # Loop through the list of lines and titlecase
       # any line beginning with '#'.
       return_value = 0
-      prev_line = lines.pop(0)
+      prev_line = lines[0]
       disabled = 0
       echo_filename = False
       if location.find("mkdocs.yml") != -1:
@@ -37,7 +37,7 @@ def main(location):
           else:
               if (line.startswith("``") or prev_line.startswith("pages:")) and disabled == 1:
                   disabled = 0
-          if line.startswith('#') and disabled == 0 and (location.find("mkdocs.yml") == -1):
+          if line.startswith('#') and (disabled == 0) and (location.find("mkdocs.yml") == -1):
             if line != titlecase(line[:(line.find("]"))], callback=abbreviations)+line[(line.find("]")):]:
               if return_value == 0 and echo_filename == False:
                 print("%s" % location)