diff --git a/maca_common/src/macaon_compute_l_rules.cpp b/maca_common/src/macaon_compute_l_rules.cpp
index 12a1b94f761571cf166843d022d30f3c290361f8..d4f425edabb54d65d65d99d73b3772c83c3eec89 100644
--- a/maca_common/src/macaon_compute_l_rules.cpp
+++ b/maca_common/src/macaon_compute_l_rules.cpp
@@ -97,7 +97,7 @@ int main(int argc, char * argv[])
   File fplm(fplmFilename, "r");
   char buffer[100000];
 
-  std::map<std::string, int> rules;
+  std::map<std::string, std::vector<std::string> > rules;
   while (fscanf(fplm.getDescriptor(), "%[^\n]\n", buffer) == 1)
   {
     auto splited = split(buffer, '\t');
@@ -112,7 +112,7 @@ int main(int argc, char * argv[])
     auto lemma = splited[2];
     auto rule = getRule(form, lemma);
 
-    rules[rule]++;
+    rules[rule].emplace_back(buffer);
   }
 
   File rulesFile(rulesFilename, "w");
@@ -120,10 +120,11 @@ int main(int argc, char * argv[])
 
   for (auto & it : rules)
   {
-    if (it.second >= threshold)
+    if ((int)it.second.size() >= threshold)
       fprintf(rulesFile.getDescriptor(), "%s\n", it.first.c_str());
     else
-      fprintf(exceptionsFile.getDescriptor(), "%s\n", it.first.c_str());
+      for (auto & line : it.second)
+        fprintf(exceptionsFile.getDescriptor(), "%s\n", line.c_str());
   }
 
   return 0;
diff --git a/transition_machine/src/Oracle.cpp b/transition_machine/src/Oracle.cpp
index a208ddab6c4e44b3780e47d8afeeae4c816d9952..9a33b9a0f277f1030a9dea9daa5dedb0eac18d1e 100644
--- a/transition_machine/src/Oracle.cpp
+++ b/transition_machine/src/Oracle.cpp
@@ -382,7 +382,6 @@ void Oracle::createDatabase()
     char b3[1024];
     char b4[1024];
 
-    while (fscanf(fd, "%[^\t]\t%[^\t]\t%[^\t]\t%[^\n]\n", b1, b2, b3, b4) != 4);
     while (fscanf(fd, "%[^\t]\t%[^\t]\t%[^\t]\t%[^\n]\n", b1, b2, b3, b4) == 4)
     {
       oracle->data[std::string(b1) + std::string("_") + b2] = b3;