--- html2book.module	2010-08-29 00:39:34.000000000 +1200
+++ html2book.module.new	2010-09-13 12:30:04.000000000 +1200
@@ -108,10 +108,21 @@ function html2book_form_alter(&$form, $f
 function html2book_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
   if ($node->type == 'book' && !empty($node->html2book) && user_access('use html2book')) {
     switch ($op) {
+    case 'presave':
+      // Break body into separate pages wherever there is a heading.
+      // Identify the heading numbers we want to use to create a new book.
+      $splitters = array_filter(array_values($node->splitters));
+      $items = preg_split('/<h(['. implode('|', $splitters) .'].*)>/U', $node->body, -1, PREG_SPLIT_DELIM_CAPTURE );
+      $node->temp = $node->body;
+      $node->body = $items[0];
+      $node->teaser = node_teaser($node->body);
+      $node->html2book_items = $items;
+      break;
     case 'update':  
     case 'insert':
       html2book_split($node, $op);
       unset($node->temp);
+      unset($node->html2book_items);
       break;
     }
   }
@@ -128,20 +139,11 @@ function html2book_split(&$node, $op) {
   $original_time = ini_get('max_execution_time');
   ini_set('max_execution_time', 0);
 
-  // Break body into separate pages wherever there is a heading.
-  // Identify the heading numbers we want to use to create a new book.
-  $splitters = array_filter(array_values($node->splitters));
-  $items = preg_split('/<h(['. implode('|', $splitters) .'].*)>/U', $node->temp, -1, PREG_SPLIT_DELIM_CAPTURE );
-
-  $node->temp = $node->body;
-  $node->body = $items[0];
-  $node->teaser = node_teaser($node->body);
-  
   // Track heading levels, weights, and page parents and children.
   $istag = FALSE;
   $weight[0] = -15;
   $prev_level = 0;
-  foreach ($items as $item) {
+  foreach ($node->html2book_items as $item) {
     if ($istag) {
       $parts = explode(' ', $item);
       $level = $parts[0];
