diff --git a/image_creator/dialog_wizard.py b/image_creator/dialog_wizard.py
index 60360d3b6881744099259bd00e5e8d48ac9e1a6a..0b1b1d705fcaf303549cc491acf0b6b8c99a2f85 100644
--- a/image_creator/dialog_wizard.py
+++ b/image_creator/dialog_wizard.py
@@ -175,7 +175,6 @@ class WizardInputPage(WizardPage):
 
 
 def wizard(session):
-
     init_token = Kamaki.get_token()
     if init_token is None:
         init_token = ""
@@ -198,14 +197,15 @@ def wizard(session):
         title="Registration Type", default="Private")
 
     def validate_account(token):
+        d = session['dialog']
+
         if len(token) == 0:
             d.msgbox("The token cannot be empty", width=PAGE_WIDTH)
             raise WizardInvalidData
 
         account = Kamaki.get_account(token)
         if account is None:
-            session['dialog'].msgbox("The token you provided in not valid!",
-                                     width=PAGE_WIDTH)
+            d.msgbox("The token you provided in not valid!", width=PAGE_WIDTH)
             raise WizardInvalidData
 
         return account