diff --git a/reading_machine/src/Action.cpp b/reading_machine/src/Action.cpp
index 92b44a370fe80db6fa2b6a2af03358280e5142a5..428b417f817b5e364a84abe17005e693c8db2eec 100644
--- a/reading_machine/src/Action.cpp
+++ b/reading_machine/src/Action.cpp
@@ -689,7 +689,7 @@ Action Action::setRootUpdateIdsEmptyStackIfSentChanged()
   auto apply = [](Config & config, Action & a)
   {
     int lineIndex = config.getWordIndex();
-    int rootIndex = -1;
+    int rootIndex = lineIndex;
     int lastSentId = -1;
     int firstIndexOfSentence = lineIndex;