diff --git a/src/comm/MAVLinkXMLParser.cc b/src/comm/MAVLinkXMLParser.cc
index 825d82ed9d8f41ce8bc3ff48f0edf4984950519b..bae01d56c1db80aaa95d05ae5bf6502c5ed657b9 100644
--- a/src/comm/MAVLinkXMLParser.cc
+++ b/src/comm/MAVLinkXMLParser.cc
@@ -219,7 +219,6 @@ bool MAVLinkXMLParser::generate()
                                         // Everything sane, starting with enum content
                                         currEnum = "enum " + enumName.toUpper() + "\n{\n";
                                         currEnumEnd = "};\n\n";
-                                        comment = e.text();
 
                                         int nextEnumValue = 0;
 
@@ -260,9 +259,9 @@ bool MAVLinkXMLParser::generate()
                                                 }
                                                 currEnum += "\t" + fieldName.toUpper() + "=" + fieldValue + "," + fieldComment + "\n";
                                             }
-                                            else if(!e.isNull() && e.tagName() == "description")
+                                            else if(!e2.isNull() && e2.tagName() == "description")
                                             {
-                                                comment = e.text() + comment;
+                                                comment = e2.text() + comment;
                                             }
                                             f = f.nextSibling();
                                         }