diff --git a/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py b/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py
index e2d2c89437..03f0afba18 100644
--- a/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py
+++ b/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py
@@ -5,8 +5,17 @@ def execute():
 	frappe.reload_doc('accounts', 'doctype', 'sales_invoice_timesheet')
 	frappe.reload_doc('accounts', 'doctype', 'sales_invoice_payment')
 	
-	for data in frappe.db.sql("""select name, mode_of_payment, cash_bank_account, paid_amount from 
-		`tabSales Invoice` where is_pos = 1 and docstatus < 2 and cash_bank_account is not null""", as_dict=1):
+	for data in frappe.db.sql("""select name, mode_of_payment, cash_bank_account, paid_amount, company 
+		from `tabSales Invoice` 
+		where is_pos = 1 and docstatus < 2 
+		and cash_bank_account is not null and cash_bank_account != ''""", as_dict=1):
+		
+		if not data.mode_of_payment and not frappe.db.exists("Mode of Payment", "Cash"):
+			mop = frappe.new_doc("Mode of Payment")
+			mop.mode_of_payment = "Cash"
+			mop.type = "Cash"
+			mop.save()
+		
 		si_doc = frappe.get_doc('Sales Invoice', data.name)
 		si_doc.append('payments', {
 			'mode_of_payment': data.mode_of_payment or 'Cash',
diff --git a/erpnext/patches/v7_0/setup_account_table_for_expense_claim_type_if_exists.py b/erpnext/patches/v7_0/setup_account_table_for_expense_claim_type_if_exists.py
index a067e71ed0..96224909ae 100644
--- a/erpnext/patches/v7_0/setup_account_table_for_expense_claim_type_if_exists.py
+++ b/erpnext/patches/v7_0/setup_account_table_for_expense_claim_type_if_exists.py
@@ -9,7 +9,8 @@ def execute():
 		return
 
 	for expense_claim_type in frappe.get_all("Expense Claim Type", fields=["name", "default_account"]):
-		if expense_claim_type.default_account:
+		if expense_claim_type.default_account \
+				and frappe.db.exists("Account", expense_claim_type.default_account):
 			doc = frappe.get_doc("Expense Claim Type", expense_claim_type.name)
 			doc.append("accounts", {
 				"company": frappe.db.get_value("Account", expense_claim_type.default_account, "company"),