diff --git a/library.py b/library.py
index cda935488ee1769192a71867f160087837dbdc13..c1466cb088e7eed7225e4aba72d098fd5a2c6642 100644
--- a/library.py
+++ b/library.py
@@ -92,7 +92,8 @@ def get_title(localroot, root, file):
             qms_yml = True
         else:
             print("QMS document is not formatted properly.")
-    else:
+
+    if not qms_yml:
         os.chdir(root)
         with open(file, 'r') as f:
             for line in f: