diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php
index 414ec4dbefebaafb3f2b765d14ae63c7244eb431..d6792e7d47c2a33d77b8b6991754a7dad31c3e56 100644
--- a/app/code/Magento/Customer/Model/Customer.php
+++ b/app/code/Magento/Customer/Model/Customer.php
@@ -725,7 +725,7 @@ class Customer extends \Magento\Framework\Model\AbstractModel
 
         $primaryShipping = $this->getPrimaryShippingAddress();
         if ($primaryShipping) {
-            if ($primaryBilling->getId() == $primaryShipping->getId()) {
+            if ($primaryBilling && $primaryBilling->getId() == $primaryShipping->getId()) {
                 $primaryBilling->setIsPrimaryShipping(true);
             } else {
                 $primaryShipping->setIsPrimaryShipping(true);
diff --git a/app/code/Magento/Tax/Setup/InstallData.php b/app/code/Magento/Tax/Setup/InstallData.php
index 03931a63e3b850c4bb7710fb428b8fb5283099ba..4e99ca1631f824f1d0306cec9c0ae200d95fc894 100644
--- a/app/code/Magento/Tax/Setup/InstallData.php
+++ b/app/code/Magento/Tax/Setup/InstallData.php
@@ -69,7 +69,7 @@ class InstallData implements InstallDataInterface
                 'visible_in_advanced_search' => true,
                 'used_in_product_listing' => true,
                 'unique' => false,
-                'apply_to' => implode($taxSetup->getTaxableItems(), ',')
+                'apply_to' => implode(',', $taxSetup->getTaxableItems())
             ]
         );