diff --git a/ChangeLog b/ChangeLog
index 096283051..a015d8064 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
 2007-01-20  Alex Roitman  <shura@gramps-project.org>
+	* src/GrampsDb/_GrampsDbBase.py (transaction_commit): Remove
+	backend-specific call.
+	* src/GrampsDb/_GrampsBSDDB.py (transaction_commit): Move surname
+	list build to work for any batch transaction.
+	* src/GrampsDb/_GrampsInMemDB.py (transaction_commit): Add method.
 	* src/Utils.py (profile): Accept and pass additional arguments.
 	* src/DataViews/_PersonView.py (delete_person_response): Busy cursor.
 
diff --git a/src/GrampsDb/_GrampsBSDDB.py b/src/GrampsDb/_GrampsBSDDB.py
index b876519d7..a3f6f1fba 100644
--- a/src/GrampsDb/_GrampsBSDDB.py
+++ b/src/GrampsDb/_GrampsBSDDB.py
@@ -1383,7 +1383,6 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
                 self.surnames.close()
                 junk = db.DB(self.env)
                 junk.remove(self.full_name,"surnames")
-                self.surnames = None
 
                 self.reference_map_referenced_map.close()
                 junk = db.DB(self.env)
@@ -1439,7 +1438,8 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
                 self.reference_map.associate(self.reference_map_referenced_map,
                                              find_referenced_handle,open_flags)
 
-                self.build_surname_list()
+            # Only build surname list after surname index is surely back
+            self.build_surname_list()
 
         self.txn = None
 
diff --git a/src/GrampsDb/_GrampsDbBase.py b/src/GrampsDb/_GrampsDbBase.py
index bf6e5c81f..0f63e8f62 100644
--- a/src/GrampsDb/_GrampsDbBase.py
+++ b/src/GrampsDb/_GrampsDbBase.py
@@ -1370,12 +1370,10 @@ class GrampsDbBase(GrampsDBCallback):
         if self.__LOG_ALL:
             log.debug("%s: Transaction commit '%s'\n"
                       % (self.__class__.__name__, str(msg)))
-        if self.readonly:
-            return
-        if not len(transaction):
-            if self.surnames != None:
-                self.build_surname_list()
+
+        if not len(transaction) or self.readonly:
             return
+
         transaction.set_description(msg)
         transaction.timestamp = time.time()
         self.undoindex += 1                    
diff --git a/src/GrampsDb/_GrampsInMemDB.py b/src/GrampsDb/_GrampsInMemDB.py
index c174b4597..941909f0c 100644
--- a/src/GrampsDb/_GrampsInMemDB.py
+++ b/src/GrampsDb/_GrampsInMemDB.py
@@ -108,6 +108,11 @@ class GrampsInMemDB(GrampsDbBase):
         self.abort_possible = True
         self.undo_history_timestamp = time.time()
 
+    def transaction_commit(self,transaction,msg):
+        GrampsDbBase.transaction_commit(self,transaction,msg)
+        if transaction.batch:
+            self.build_surname_list()
+
     def get_person_cursor(self):
         return GrampsInMemCursor(self.person_map)