diff --git a/addon/doxywizard/expert.cpp b/addon/doxywizard/expert.cpp
index efc5b00..e85b14c 100644
--- a/addon/doxywizard/expert.cpp
+++ b/addon/doxywizard/expert.cpp
@@ -22,7 +22,7 @@ static QString convertToComment(const QString &s)
   else
   {
     return SA("# ")+
-           s.trimmed().replace(SA("\n"),SA("\n# "))+
+           s.trimmed().replace(SA("\n"),SA("\n# ")).replace(SA("# \n"), SA("#\n"))+
            SA("\n");
   }
 }
@@ -722,9 +722,10 @@ void Expert::saveTopic(QTextStream &t,QDomElement &elem,QTextCodec *codec,
           t << convertToComment(option->templateDocs());
           t << endl;
         }
-        t << name.leftJustified(MAX_OPTION_LENGTH) << "= ";
-        if (option)
+        t << name.leftJustified(MAX_OPTION_LENGTH) << "=";
+        if (option && option.isNotEmpty())
         {
+	  t << " ";
           option->writeValue(t,codec);
         }
         t << endl;
