diff --git book_delete.module book_delete.module
index c7e5598..e1797f6 100644
--- book_delete.module
+++ book_delete.module
@@ -135,18 +135,17 @@ function book_delete_delete($bid, &$context) {
   // Delete 5 nodes at a time.  This needs to be set fairly low as there may be 
   // many search index deletions for each node.
   $limit = 5;
-  $result = db_query_range("SELECT nid FROM {book} WHERE bid = :bid AND nid > :nid AND nid <> bid ORDER BY nid ASC", 0, $limit, array(
+  $nids = db_query_range("SELECT nid FROM {book} WHERE bid = :bid AND nid > :nid AND nid <> bid ORDER BY nid ASC", 0, $limit, array(
     ':bid' => $context['sandbox']['bid'],
     ':nid' => $context['sandbox']['highest_nid'],
     ))->fetchCol();
   if (!empty($nids)) {
     node_delete_multiple($nids);
+    // Update our progress information.
+    $context['sandbox']['progress'] += count($nids);
+    $context['sandbox']['highest_nid'] = array_pop($nids);
   }
-  
-  // Update our progress information.
-  $context['sandbox']['progress'] += count($nids);
-  $context['sandbox']['highest_nid'] = array_pop($nids);
-  
+
   // Delete the top book node last.
   if ($context['sandbox']['progress'] == $context['sandbox']['max'] - 1) {
     node_delete($context['sandbox']['bid']);
