diff --git a/wetb/hawc2/htc_contents.py b/wetb/hawc2/htc_contents.py
index 93b58f077cfd2fb2cdb12c9cfdb663f0a813cb76..5d602962603fef5ba1ce21461320999dd6971849 100644
--- a/wetb/hawc2/htc_contents.py
+++ b/wetb/hawc2/htc_contents.py
@@ -133,8 +133,8 @@ class HTCSection(HTCContents):
     begin_comments = ""
     def __init__(self, name, begin_comments="", end_comments=""):
         self.name_ = name
-        self.begin_comments = begin_comments
-        self.end_comments = end_comments
+        self.begin_comments = begin_comments.strip(" \t")
+        self.end_comments = end_comments.strip(" \t")
         self.contents = OrderedDict()
 
     @staticmethod
@@ -174,7 +174,7 @@ class HTCLine(HTCContents):
             name = name[:name.index("__")]
         self.name_ = name
         self.values = list(values)
-        self.comments = comments
+        self.comments = comments.strip(" \t")
 
     def __repr__(self):
         return str(self)
@@ -228,7 +228,7 @@ class HTCOutputSection(HTCSection):
 
 
     def line_from_line(self, lines):
-        while lines[0].strip() == "":
+        while len(lines) and lines[0].strip() == "":
             lines.pop(0)
         name = lines[0].split()[0].strip()
         if name in ['filename', 'data_format', 'buffer', 'time']:
diff --git a/wetb/hawc2/htc_file.py b/wetb/hawc2/htc_file.py
index 64456106b2ceb33eb1005cccd8fa906752119e3a..287c33be0efc5e503566975fe6a880598e4f6e1e 100644
--- a/wetb/hawc2/htc_file.py
+++ b/wetb/hawc2/htc_file.py
@@ -334,6 +334,7 @@ class HTCFile(HTCContents, HTCDefaults):
                 exe_file = os.path.join(self.modelpath, exe)
             #print (from_unix(getmtime(res_file)), from_unix(getmtime(htc_file)))
             if (isfile(htc_file) and isfile(res_file) and isfile(exe_file) and
+                str(HTCFile(htc_file))==str(self) and
                 getmtime(res_file) > getmtime(htc_file) and getmtime(res_file) > getmtime(exe_file)):
                 if "".join(self.readfilelines(htc_file)) == str(self):
                         return