--- auto_nodetitle.module	2010-08-03 17:22:12.000000000 +0000
+++ auto_nodetitle.module	2010-08-03 17:25:31.000000000 +0000
@@ -62,8 +62,34 @@ function auto_nodetitle_node_form_submit
  * Implementation of hook_nodeapi().
  */
 function auto_nodetitle_nodeapi(&$node, $op) {
-  if ($op == 'presave' && auto_nodetitle_is_needed($node)) {
-    auto_nodetitle_set_title($node);
+  switch ($op) {
+    case 'presave':
+    case 'validate':
+      if (auto_nodetitle_is_needed($node)) {
+        auto_nodetitle_set_title($node);
+      }
+    break;
+    case 'insert':
+      if (!$node->auto_nodetitle_applied) break;
+      $old_node_title = $node->title;
+      // Clear the applied flag as the title saved during presave may be invalid
+      unset($node->auto_nodetitle_applied);
+      $node->title = '';
+      if (auto_nodetitle_is_needed($node)) {
+        auto_nodetitle_set_title($node);
+        if($old_node_title != $node->title){
+          // Update node title directly, without invoking hook_nodeapi()
+          db_query("UPDATE {node} SET title = '%s' WHERE nid = %d", $node->title, $node->nid);
+          db_query("UPDATE {node_revisions} SET title = '%s' WHERE nid = %d AND vid = %d", $node->title, $node->nid, $node->vid);
+
+          // Invoke pathauto for paths based on the node title
+          if(module_exists('pathauto')){
+            $placeholders = pathauto_get_placeholders('node', $node);
+            pathauto_create_alias('node', 'bulkupdate', $placeholders, "node/$node->nid", $node->nid, $node->type);
+          }
+        }
+      }
+    break;
   }
 }
 
