diff --git a/transition_machine/src/ActionBank.cpp b/transition_machine/src/ActionBank.cpp
index 4dbf8e350aa6599abde0eb3a97522f9ee31484b5..cadee4f6453dd25f15aa6ba1f7984c705f708360 100644
--- a/transition_machine/src/ActionBank.cpp
+++ b/transition_machine/src/ActionBank.cpp
@@ -567,6 +567,11 @@ std::vector<Action::BasicAction> ActionBank::str2sequence(const std::string & na
           if (c.pastActions.size() == 0)
             return false;
 
+          if (c.getCurrentStateHistory().size() > 0 && c.getCurrentStateHistory().top() != "EPSILON")
+          {
+            return false;
+          }
+
           const std::string & classifierName = c.pastActions.top().first;
 
           if (c.hashHistory.contains(c.computeHash()))
@@ -580,10 +585,10 @@ std::vector<Action::BasicAction> ActionBank::str2sequence(const std::string & na
             {
               topIndex++;
 
-              if (topIndex >= c.pastActions.size())
+              if (topIndex > c.pastActions.size())
                 return;
 
-              if (c.pastActions.getElem(topIndex).first == classifierName)
+              if (c.pastActions.getElem(topIndex-1).first == classifierName)
                 return;
             }
           };