diff --git a/auto_nodetitle.module b/auto_nodetitle.module
index c35a271..00ad8b2 100644
--- a/auto_nodetitle.module
+++ b/auto_nodetitle.module
@@ -31,12 +31,10 @@ function auto_nodetitle_form_alter(&$form, $form_state, $form_id) {
       $form['title']['#value'] = 'ant';
       $form['title']['#type'] = 'value';
       $form['title']['#required'] = FALSE;
-      $form['#submit'][] = 'auto_nodetitle_node_form_submit';
     }
     else if (auto_nodetitle_get_setting($form['#node']->type) == AUTO_NODETITLE_OPTIONAL) {
       // we will make the title optional
       $form['title']['#required'] = FALSE;
-      $form['#submit'][] = 'auto_nodetitle_node_form_submit';
     }
   }
 }
@@ -45,14 +43,11 @@ function auto_nodetitle_form_alter(&$form, $form_state, $form_id) {
  * Makes sure the node preview is shown right.
  * It gets the node object, modifies the title, and updates the node in the form_state.
  */
-function auto_nodetitle_node_form_submit($form, &$form_state) {
-  // Only do something, if the user clicked the preview button.
-  if (isset($form_state['clicked_button']['#submit']) && in_array('node_form_build_preview', $form_state['clicked_button']['#submit'])) {
-    $setting = auto_nodetitle_get_setting($form_state['values']['type']);
-    if ($setting == AUTO_NODETITLE_ENABLED || ($setting == AUTO_NODETITLE_OPTIONAL && empty($form_state['values']['title']))) {
-      $node = node_submit($form_state['values']);
+function auto_nodetitle_nodeapi($node, $op) {
+  if ($op == 'presave') {
+    $setting = auto_nodetitle_get_setting($node->type);
+    if ($setting == AUTO_NODETITLE_ENABLED || ($setting == AUTO_NODETITLE_OPTIONAL && empty($node->title))) {
       auto_nodetitle_set_title($node);
-      $form_state['values'] = (array)$node;
     }
   }
 }
