diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp
index 5d0b79c92f4826738cc19d0966779299b3d937dd..bc208691dafb2f8022707144cc805fca286e63a0 100755
--- a/sflphone-common/src/managerimpl.cpp
+++ b/sflphone-common/src/managerimpl.cpp
@@ -1413,6 +1413,28 @@ bool ManagerImpl::saveConfig (void) {
 	setConfig(AUDIO, VOLUME_SPKR, getSpkrVolume());
 	setConfig(AUDIO, VOLUME_MICRO, getMicVolume());
 
+	AccountMap::iterator iter = _accountMap.begin();
+
+	try{
+	  emitter = new Conf::YamlEmitter("/tmp/sequenceEmiter.txt");
+
+	  // emitter->writeAccount(&accountmap);
+	  // emitter->writeAccount(&accountmap);
+	  emitter->serializeData();
+
+	  while(iter != _accountMap.end()) {
+	    iter->second->serialize(emitter);
+	    iter++;
+	  }
+
+	  preferences.serialize(emitter);
+
+	  delete emitter;
+	}
+	catch (Conf::YamlEmitterException &e) {
+	  _error("ConfigTree: %s", e.what());
+	}
+
 	_setupLoaded = _config.saveConfigTree(_path.data());
 	return _setupLoaded;
 }
diff --git a/sflphone-common/src/managerimpl.h b/sflphone-common/src/managerimpl.h
index 608f369524edc465936abf18ab1d084a30a9c4cf..1f79de5c5dd596a81aa385e22a56eb9b535c9a0f 100755
--- a/sflphone-common/src/managerimpl.h
+++ b/sflphone-common/src/managerimpl.h
@@ -55,6 +55,7 @@
 #include "audio/codecs/codecDescriptor.h" // CodecDescriptor class contained by value here
 
 #include "audio/mainbuffer.h"
+#include "yamlemitter.h"
 #include "yamlparser.h"
 #include "preferences.h"
 
@@ -1347,6 +1348,7 @@ private:
     void check_call_configuration (const CallID& id, const std::string& to, Call::CallConfiguration *callConfig);
 
     Conf::YamlParser *parser;
+    Conf::YamlEmitter *emitter;
 
 #ifdef TEST
     bool testCallAccountMap();
diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp
index 699e21f2a677e1529a58db5249da1e696da00a15..49667c510586e363a229330bb84dcd9176e71d09 100755
--- a/sflphone-common/src/sip/sipaccount.cpp
+++ b/sflphone-common/src/sip/sipaccount.cpp
@@ -134,6 +134,8 @@ SIPAccount::~SIPAccount()
 
 void SIPAccount::serialize(Conf::YamlEmitter *emitter) {
 
+  _debug("SipAccount: serialize %s", _accountID.c_str());
+
 
   Conf::MappingNode accountmap(NULL);
   Conf::MappingNode credentialmap(NULL);
@@ -152,6 +154,7 @@ void SIPAccount::serialize(Conf::YamlEmitter *emitter) {
   Conf::ScalarNode interface(_interface);
   std::stringstream portstr; portstr << _localPort;
   Conf::ScalarNode port(portstr.str());
+
   Conf::ScalarNode mailbox("97");
   Conf::ScalarNode publishAddr(_publishedIpAddress);
   std::stringstream publicportstr; publicportstr << _publishedPort;
@@ -166,7 +169,7 @@ void SIPAccount::serialize(Conf::YamlEmitter *emitter) {
 
   std::stringstream countstr; countstr << _credentialCount;
   Conf::ScalarNode count(countstr.str());
-  
+
   Conf::ScalarNode srtpenabled(_srtpEnabled ? "true" : "false");
   Conf::ScalarNode keyExchange(_srtpKeyExchange);
   Conf::ScalarNode rtpFallback(_srtpFallback ? "true" : "false");
@@ -496,6 +499,9 @@ int SIPAccount::registerVoIPLink()
         _transportType = PJSIP_TRANSPORT_START_OTHER;
         initStunConfiguration ();
     }
+    else {
+      _stunServerName = pj_str ((char*) _stunServer.data());
+    }
 
     // In our definition of the
     // ip2ip profile (aka Direct IP Calls),