diff --git a/src/cutecoin/core/app.py b/src/cutecoin/core/app.py
index 8c31a77c63a27bddb42861f398247ea0237be889..3893d1438b44325b500998d6da20f8c5a4caeffe 100644
--- a/src/cutecoin/core/app.py
+++ b/src/cutecoin/core/app.py
@@ -92,6 +92,8 @@ class Application(QObject):
         self.accounts.pop(account.name)
         if self.current_account == account:
             self.current_account = None
+        with open(config.parameters['data'], 'w') as outfile:
+            json.dump(self.jsonify(), outfile, indent=4, sort_keys=True)
 
     def change_current_account(self, account):
         '''
diff --git a/src/cutecoin/gui/import_account.py b/src/cutecoin/gui/import_account.py
index 5fd598c811bbb9d50fdbda4d37d38c621fb27cae..5550e5a99a7e6d7dafdeb562de9cafaf476e911a 100644
--- a/src/cutecoin/gui/import_account.py
+++ b/src/cutecoin/gui/import_account.py
@@ -58,7 +58,7 @@ class ImportAccountDialog(QDialog, Ui_ImportAccountDialog):
             self.label_errors.setText("Please enter a name")
             return
         for account in self.app.accounts:
-            if name == account.name:
+            if name == account:
                 self.button_box.button(QDialogButtonBox.Ok).setEnabled(False)
                 self.label_errors.setText("Name already exists")
                 return