diff --git a/uc_taxes/uc_taxes.module b/uc_taxes/uc_taxes.module
index a1d8322..809a197 100644
--- a/uc_taxes/uc_taxes.module
+++ b/uc_taxes/uc_taxes.module
@@ -238,32 +238,42 @@ function uc_line_item_tax($op, $order) {
 /**
  * Handles the line item subtotal before taxes.
  */
-function uc_line_item_tax_subtotal($op, $order) {
+function uc_line_item_tax_subtotal($op, $arg1) {
   $amount = 0;
   $has_taxes = FALSE;
   $different = FALSE;
 
-  if (is_array($order->products)) {
-    foreach ($order->products as $item) {
-      $amount += $item->price * $item->qty;
+  if ($op == 'load') {
+    $order = $arg1;
+    if (isset($order->taxes) && is_array($order->taxes)) {
+      $has_taxes = TRUE;
     }
-  }
-  if (is_array($order->line_items)) {
-    foreach ($order->line_items as $key => $line_item) {
-      if ($line_item['type'] == 'subtotal') {
-        continue;
-      }
-      if (substr($line_item['type'], 0, 3) != 'tax') {
-        $amount += $line_item['amount'];
-        $different = TRUE;
+    if (is_array($order->products)) {
+      foreach ($order->products as $item) {
+        $amount += $item->price * $item->qty;
       }
-      else {
-        $has_taxes = TRUE;
+    }
+    if (!empty($order->line_items)) {
+      foreach ($order->line_items as $key => $line_item) {
+        if ($line_item['type'] == 'subtotal') {
+          continue;
+        }
+        if (substr($line_item['type'], 0, 3) != 'tax') {
+          $amount += $line_item['amount'];
+          $different = TRUE;
+        }
+        else {
+          $has_taxes = TRUE;
+        }
       }
     }
   }
-  if (isset($order->taxes) && is_array($order->taxes)) {
-    $has_taxes = TRUE;
+  elseif ($op == 'cart-preview') {
+    if (is_array($arg1)) {
+      foreach ($arg1 as $item) {
+        $amount += $item->price * $item->qty;
+      }
+    }
   }
   if ($different && $has_taxes) {
     switch ($op) {
@@ -273,7 +283,8 @@ function uc_line_item_tax_subtotal($op, $order) {
             set_line_item('tax_subtotal', '". t('Subtotal excluding taxes') ."', ". $amount .", ". variable_get('uc_li_tax_subtotal_weight', 8) .");
           }
         })};", 'inline');
-      break;
+        break;
+
       case 'load':
         return array(array(
           'id' => 'tax_subtotal',
