diff --git a/sites/all/modules/contrib/ubercart/uc_addresses/class/UcAddressesAddressBook.class.php b/sites/all/modules/contrib/ubercart/uc_addresses/class/UcAddressesAddressBook.class.php
index 22f1261..c9c83df 100644
--- a/sites/all/modules/contrib/ubercart/uc_addresses/class/UcAddressesAddressBook.class.php
+++ b/sites/all/modules/contrib/ubercart/uc_addresses/class/UcAddressesAddressBook.class.php
@@ -334,16 +334,24 @@ class UcAddressesAddressBook {
    *   FALSE otherwise.
    */
   public function compareAddress(UcAddressesAddress $address) {
-    if (!$this->allLoaded) {
-      $this->loadAll();
-    }
-
-    foreach ($this->addresses as $addressBookAddress) {
+    global $user;
+    $uid = $user->uid;
+    $addresses_uc_address_table = UcAddressesAddressBook::get($uid)->getAddresses();
+    // skip when all indexes are negative in addressbook; this means uc_addresses table has no rows for this user
+    if(empty($addresses_uc_address_table) || $this->arrayindex_all_negative($addresses_uc_address_table)) {
+        return FALSE;
+    }
+    foreach ($addresses_uc_address_table as $addressBookAddress) {
       if ($address === $addressBookAddress) {
         // We don't need to compare the address with itself
         continue;
       }
-
+       //if address index is negative, continue because it does not contain address from UCAddressBook
+      $aid_array = $addressBookAddress->getRawFieldData();
+      $aid = $aid_array['aid'];
+      if ($aid < 0) {
+          continue;
+      }
       if ($addressBookAddress->compareAddress($address)) {
         // Found a match! No need to look further.
         return $addressBookAddress;
@@ -351,7 +359,22 @@ class UcAddressesAddressBook {
     }
     return FALSE;
   }
-
+  /**
+   * When all the indexes are negative in $address array, then uc_addresses does not contain saved addresses for this user
+   * Negative indexes store addresses from the orders form or uc_orders table,
+   * which are not to be compared; want to compare only those address entries with positive indexes.
+   * @param type $address: user's uc_AddressBook
+   * @return boolean 
+   */
+    public function arrayindex_all_negative($address){
+      $keys = array_keys($address);
+      foreach ($keys as $key) {
+          if ($key > 0) {
+              return FALSE;
+          }
+      }
+      return TRUE;
+  }
   /**
    * Checks if an address exists in the addresses array
    *
