diff --git a/modules/conop/src/compound.cc b/modules/conop/src/compound.cc
index dfa1a69f92677cb163fd1826313dfd09c8e255e5..4e4500969e004b25be00fcdb667549a0f7b5ea3b 100644
--- a/modules/conop/src/compound.cc
+++ b/modules/conop/src/compound.cc
@@ -29,4 +29,16 @@ int Compound::GetAtomSpecIndex(const String& name) const {
   }
   return -1;
 }
+String Date::ToString() const
+{
+  std::stringstream ss;
+  ss << year << "-";
+  ss.fill('0');
+  ss.width(2);
+  ss << month << "-";
+  ss.fill('0');
+  ss.width(2);
+  ss << day;
+  return ss.str();
+}
 }}
diff --git a/modules/conop/src/compound.hh b/modules/conop/src/compound.hh
index 45466a1cc228bd824e43aeedac82dfd47498077b..baca26eb74e5d0a576841486cb7b5be2c74fb4d0 100644
--- a/modules/conop/src/compound.hh
+++ b/modules/conop/src/compound.hh
@@ -61,6 +61,8 @@ struct Date {
     return Date(year.second, month.second, day.second);
   }
   
+  String ToString() const;
+
   int year;
   int month;
   int day;  
diff --git a/modules/conop/src/compound_lib.cc b/modules/conop/src/compound_lib.cc
index 020c3468c35d95a284e98629963d61b383f72f36..61c8fc11ad11986fffcd49ae1789ae38fdc7db88 100644
--- a/modules/conop/src/compound_lib.cc
+++ b/modules/conop/src/compound_lib.cc
@@ -103,6 +103,7 @@ void CompoundLib::AddCompound(const CompoundPtr& compound)
   sqlite3_stmt* stmt=NULL;  
   int retval=sqlite3_prepare_v2(conn_, INSERT_COMPOUND_STATEMENT, 
                                 strlen(INSERT_COMPOUND_STATEMENT), &stmt, NULL);
+  String crea_date_str, modi_date_str;
   if (SQLITE_OK==retval) {
     sqlite3_bind_text(stmt, 1, compound->GetID().c_str(), 
                       compound->GetID().length(), NULL);
@@ -116,30 +117,15 @@ void CompoundLib::AddCompound(const CompoundPtr& compound)
     sqlite3_bind_text(stmt, 5, &chem_type, 1, NULL);
     sqlite3_bind_text(stmt, 6, compound->GetFormula().c_str(),
                       compound->GetFormula().length(), NULL);
-    std::stringstream ss;
-    ss << compound->GetCreationDate().year << "-";
-    ss.fill('0');
-    ss.width(2);
-    ss << compound->GetCreationDate().month << "-";
-    ss.fill('0');
-    ss.width(2);
-    ss << compound->GetCreationDate().day;
-    String date=ss.str();
-    ss.str("");
-    ss << compound->GetModificationDate().year << "-";
-    ss.fill('0');
-    ss.width(2);
-    ss << compound->GetModificationDate().month << "-";
-    ss.fill('0');
-    ss.width(2);
-    ss << compound->GetModificationDate().day;
-    sqlite3_bind_text(stmt, 7, date.c_str(), date.length(), NULL);
-    date=ss.str();
-    sqlite3_bind_text(stmt, 8, date.c_str(), date.length(), NULL);
-    sqlite3_bind_text(stmt, 9, compound->GetName().c_str(), compound->GetName().length(), NULL);
+    Date crea_date=compound->GetCreationDate();
+    Date modi_date=compound->GetModificationDate();
+    crea_date_str=crea_date.ToString();
+    modi_date_str=modi_date.ToString();
+    sqlite3_bind_text(stmt, 7, crea_date_str.c_str(), crea_date_str.length(), NULL);
+    sqlite3_bind_text(stmt, 8, modi_date_str.c_str(), modi_date_str.length(), NULL);
   } else {
     LOG_ERROR(sqlite3_errmsg(conn_));
-    sqlite3_finalize(stmt);    
+    sqlite3_finalize(stmt);
     return;
   }
   retval=sqlite3_step(stmt);