diff --git a/src/document/Document.cc b/src/document/Document.cc
index b6481e9010..4343d694e5 100644
--- a/src/document/Document.cc
+++ b/src/document/Document.cc
@@ -79,7 +79,7 @@ int Document::insert(SqlDB *db, string& error_str)
// Check default attributes
// ---------------------------------------------------------------------
- get_template_attribute("NAME", name);
+ erase_template_attribute("NAME", name);
if ( name.empty() == true )
{
@@ -199,8 +199,8 @@ string& Document::to_xml(string& xml) const
<< "" << oid << ""
<< "" << uid << ""
<< "" << gid << ""
- << "" << uname << ""
- << "" << gname << ""
+ << "" << uname << ""
+ << "" << gname << ""
<< "" << name << ""
<< "" << type << ""
<< perms_to_xml(perm_str)
diff --git a/src/vm_template/VMTemplate.cc b/src/vm_template/VMTemplate.cc
index af638437fd..822885c0ad 100644
--- a/src/vm_template/VMTemplate.cc
+++ b/src/vm_template/VMTemplate.cc
@@ -81,7 +81,7 @@ int VMTemplate::insert(SqlDB *db, string& error_str)
// Check default attributes
// ---------------------------------------------------------------------
- get_template_attribute("NAME", name);
+ erase_template_attribute("NAME", name);
if ( name.empty() == true )
{