diff --git a/reading_machine/src/BaseConfig.cpp b/reading_machine/src/BaseConfig.cpp
index 4997f6ef68e2dd2ebb32ed006c9b9c54c834f4a9..8ca5ab32858f461de33b52deaae78a0b7ad5d666 100644
--- a/reading_machine/src/BaseConfig.cpp
+++ b/reading_machine/src/BaseConfig.cpp
@@ -106,15 +106,16 @@ void BaseConfig::readTSVInput(std::string_view tsvFilename)
           firstIndexOfSequence = i;
           id2index[getConst(idColName, i, 0)] = i;
         }
-        for (int i = firstIndexOfSequence; i < (int)getNbLines(); ++i)
-        {
-          if (!isToken(i))
-            continue;
-          auto & head = get(headColName, i, 0);
-          if (head == "0")
-            continue;
-          head = std::to_string(id2index[head]);
-        }
+        if (hasColIndex(headColName))
+          for (int i = firstIndexOfSequence; i < (int)getNbLines(); ++i)
+          {
+            if (!isToken(i))
+              continue;
+            auto & head = get(headColName, i, 0);
+            if (head == "0")
+              continue;
+            head = std::to_string(id2index[head]);
+          }
       } catch(std::exception & e) {util::myThrow(e.what());}
 
       continue;
diff --git a/reading_machine/src/Config.cpp b/reading_machine/src/Config.cpp
index 50e7f6180d9f95eb316f345473be75033d19782d..1ecf0725b1b27246a449afbb7462e266569b255d 100644
--- a/reading_machine/src/Config.cpp
+++ b/reading_machine/src/Config.cpp
@@ -605,8 +605,9 @@ void Config::addMissingColumns()
     if (curId == 1)
       firstIndex = index;
 
-    if (util::isEmpty(getAsFeature(headColName, index)))
-      getLastNotEmptyHyp(headColName, index) = (curId == 1) ? "0" : std::to_string(firstIndex);
+    if (hasColIndex(headColName))
+      if (util::isEmpty(getAsFeature(headColName, index)))
+        getLastNotEmptyHyp(headColName, index) = (curId == 1) ? "0" : std::to_string(firstIndex);
   }
 }