diff --git a/src/dictionaries/morphosyntactic/ner_file.py b/src/dictionaries/morphosyntactic/ner_file.py
index f31dde7dbb9aa19fee024c49b9d4994c9fbcd98d..55a4b65646517a559ad2963157cec5a39f722b90 100644
--- a/src/dictionaries/morphosyntactic/ner_file.py
+++ b/src/dictionaries/morphosyntactic/ner_file.py
@@ -92,22 +92,28 @@ class NERFileMorphosyntacticDictionary(MorphosyntacticDictionary):
 
             if original_entry_type_name in self._dictionary:
                 entry_type = original_entry_type_name
-
-                if morpho_tag in self._dictionary[entry_type] \
-                        and morpho_tag in self._dictionary[entry_type]:
-                    lemma = random.choice(
-                        list(self._dictionary[entry_type][morpho_tag].keys())
-                    )
-
-                    word = self._dictionary[entry_type][morpho_tag][lemma]
-                else:
-                    morpho_tag = random.choice(
-                        list(self._dictionary[entry_type].keys())
-                    )
-                    lemma = random.choice(
-                        list(self._dictionary[entry_type][morpho_tag].keys())
-                    )
-                    word = lemma
+                try:
+                    if entry_type in self._dictionary \
+                            and morpho_tag in self._dictionary[entry_type] \
+                            and len(list(self._dictionary[
+                                             entry_type][morpho_tag].keys())) > 0:
+                        lemma = random.choice(
+                            list(self._dictionary[entry_type][morpho_tag].keys())
+                        )
+
+                        word = self._dictionary[entry_type][morpho_tag][lemma]
+                    else:
+                        morpho_tag = random.choice(
+                            list(self._dictionary[entry_type].keys())
+                        )
+                        lemma = random.choice(
+                            list(self._dictionary[entry_type][morpho_tag].keys())
+                        )
+                        word = lemma
+                except IndexError as exp:
+                    print(f"IndexError entry_type {entry_type} morpho_tag {morpho_tag}")
+                    print(exp)
+                    print(f"Dictionary {self._dictionary[entry_type][morpho_tag]}")
 
         if word is None and self._always_replace:
             entry_type = random.choice(list(self._dictionary.keys()))