--- uc_product_power_tools.admin.inc	2011-10-16 22:38:04.000000000 -0600
+++ uc_product_power_tools.admin.inc	2012-02-03 16:28:52.262567262 -0700
@@ -526,8 +526,42 @@
   $width          = $form_state['values']['width'];
   $height         = $form_state['values']['height'];
 
-  db_query('REPLACE INTO {uc_power_tools} (pcid, enabled, asku, asku_settings, lp, lp_settings, cost, cost_settings, sp, sp_settings, dq, dq_settings, pq, pq_settings, ship, weight, weight_units, length_units, length, width, height, lpos, lpos_settings, stock, stock_settings, stock_threshold) VALUES (:settings)',
-    array(':settings' => array($pcid, $enabled, $asku, $askusettings, $lp, $lpsettings, $cost, $costsettings, $sp, $spsettings, $dq, $dqsettings, $pq, $pqsettings, $ship, $weight, $weight_units, $length_units, $length, $width, $height, $lpos, $lpossettings, $stock, $stocksettings, $stockthreshold)));
+  //db_query('REPLACE INTO {uc_power_tools} (pcid, enabled, asku, asku_settings, lp, lp_settings, cost, cost_settings, sp, sp_settings, dq, dq_settings, pq, pq_settings, ship, weight, weight_units, length_units, length, width, height, lpos, lpos_settings, stock, stock_settings, stock_threshold) VALUES (:settings)',
+    //array(':settings' => array($pcid, $enabled, $asku, $askusettings, $lp, $lpsettings, $cost, $costsettings, $sp, $spsettings, $dq, $dqsettings, $pq, $pqsettings, $ship, $weight, $weight_units, $length_units, $length, $width, $height, $lpos, $lpossettings, $stock, $stocksettings, $stockthreshold)));
+  db_merge('uc_power_tools')
+   ->key(array(
+      'pcid' => $pcid,
+   ))
+   ->fields(array(
+      'pcid' => $pcid,
+      'enabled' => $enabled,
+      'asku' => $asku,
+      'asku_settings' => $askusettings,
+      'lp' => $lp,
+      'lp_settings' => $lpsettings,
+      'cost' => $cost,
+      'cost_settings' => $costsettings,
+      'sp' => $sp,
+      'sp_settings' => $spsettings,
+      'dq' => $dq,
+      'dq_settings' => $dqsettings,
+      'pq' => $pq,
+      'pq_settings' => $pqsettings,
+      'ship' => $ship,
+      'weight' => $weight,
+      'weight_units' => $weight_units,
+      'length_units' => $length_units,
+      'length' => $length,
+      'width' => $width,
+      'height' => $height,
+      'lpos' => $lpos,
+      'lpos_settings' => $lpossettings,
+      'stock' => $stock,
+      'stock_settings' => $stocksettings,
+      'stock_threshold' => $stockthreshold,
+   ))
+   ->execute();
+    
 
   drupal_set_message(t('Power Tools settings saved.'));
   drupal_goto('admin/store/products/power-tools');
@@ -567,8 +601,41 @@
   $width          = $existing['width'];
   $height         = $existing['height'];
 
-  db_query('REPLACE INTO {uc_power_tools} (pcid, enabled, asku, asku_settings, lp, lp_settings, cost, cost_settings, sp, sp_settings, dq, dq_settings, pq, pq_settings, ship, weight, weight_units, length_units, length, width, height, lpos, lpos_settings, stock, stock_settings, stock_threshold) VALUES (:settings)',
-    array(':settings' => array($pcid, $enabled, $asku, $askusettings, $lp, $lpsettings, $cost, $costsettings, $sp, $spsettings, $dq, $dqsettings, $pq, $pqsettings, $ship, $weight, $weight_units, $length_units, $length, $width, $height, $lpos, $lpossettings, $stock, $stocksettings, $stockthreshold)));
+  //db_query('REPLACE INTO {uc_power_tools} (pcid, enabled, asku, asku_settings, lp, lp_settings, cost, cost_settings, sp, sp_settings, dq, dq_settings, pq, pq_settings, ship, weight, weight_units, length_units, length, width, height, lpos, lpos_settings, stock, stock_settings, stock_threshold) VALUES (:settings)',
+    //array(':settings' => array($pcid, $enabled, $asku, $askusettings, $lp, $lpsettings, $cost, $costsettings, $sp, $spsettings, $dq, $dqsettings, $pq, $pqsettings, $ship, $weight, $weight_units, $length_units, $length, $width, $height, $lpos, $lpossettings, $stock, $stocksettings, $stockthreshold)));
+  db_merge('uc_power_tools')
+   ->key(array(
+      'pcid' => $pcid,
+   ))
+   ->fields(array(
+      'pcid' => $pcid,
+      'enabled' => $enabled,
+      'asku' => $asku,
+      'asku_settings' => $askusettings,
+      'lp' => $lp,
+      'lp_settings' => $lpsettings,
+      'cost' => $cost,
+      'cost_settings' => $costsettings,
+      'sp' => $sp,
+      'sp_settings' => $spsettings,
+      'dq' => $dq,
+      'dq_settings' => $dqsettings,
+      'pq' => $pq,
+      'pq_settings' => $pqsettings,
+      'ship' => $ship,
+      'weight' => $weight,
+      'weight_units' => $weight_units,
+      'length_units' => $length_units,
+      'length' => $length,
+      'width' => $width,
+      'height' => $height,
+      'lpos' => $lpos,
+      'lpos_settings' => $lpossettings,
+      'stock' => $stock,
+      'stock_settings' => $stocksettings,
+      'stock_threshold' => $stockthreshold,
+   ))
+   ->execute();
 
   drupal_set_message(t('Power Tools settings have been cloned.'));
 }
