diff --git a/planetstack/openstack_observer/steps/sync_slice_deployments.py b/planetstack/openstack_observer/steps/sync_slice_deployments.py
index 4c358d7..617791e 100644
--- a/planetstack/openstack_observer/steps/sync_slice_deployments.py
+++ b/planetstack/openstack_observer/steps/sync_slice_deployments.py
@@ -48,41 +48,42 @@
             logger.info("deployment %r has no admin_user, skipping" % slice_deployment.deployment)
             return
 
-	deployment_users = UserDeployments.objects.filter(user=slice_deployment.slice.creator,
-                                                             deployment=slice_deployment.deployment)            
-    	if not deployment_users:
-	    logger.info("slice createor %s has not accout at deployment %s" % (slice_deployment.slice.creator, slice_deployment.deployment.name))
-	    roles = []
-    	else:
-	    deployment_user = deployment_users[0]
-	    roles = ['admin']
-	    
-	max_instances=int(slice_deployment.slice.max_slivers)
-	tenant_fields = {'endpoint':slice_deployment.deployment.auth_url,
-		         'admin_user': slice_deployment.deployment.admin_user,
-		         'admin_password': slice_deployment.deployment.admin_password,
-		         'admin_tenant': 'admin',
-		         'tenant': slice_deployment.slice.name,
-		         'tenant_description': slice_deployment.slice.description,
-			 'roles':roles,
-			 'name':deployment_user.user.email,
-			 'max_instances':max_instances}
+        deployment_users = UserDeployments.objects.filter(user=slice_deployment.slice.creator,
+                                                             deployment=slice_deployment.deployment)
+        if not deployment_users:
+            logger.info("slice createor %s has not accout at deployment %s" % (slice_deployment.slice.creator, slice_deployment.deployment.name))
+            roles = ['admin']
+			deployment_user = 'Undefined'
+        else:
+            deployment_user = deployment_users[0].user.email
+            roles = ['admin']
 
-	res = run_template('sync_slice_deployments.yaml', tenant_fields)
-	expected_num = len(roles)+1
-	if (len(res)!=expected_num):
-	    raise Exception('Could not sync tenants for slice %s'%slice_deployment.slice.name)
-	else:
-	    tenant_id = res[0]['id']
-	    if (not slice_deployment.tenant_id):
-	        handle = os.popen('nova quota-update --instances %d %s'%(max_instances,tenant_id))
-		output = handle.read()
-		result = handle.close()
-		if (result):
-		    logging.info('Could not update quota for %s'%slice_deployment.slice.name)
-		slice_deployment.tenant_id = tenant_id
-		slice_deployment.save()
-			
+        max_instances=int(slice_deployment.slice.max_slivers)
+        tenant_fields = {'endpoint':slice_deployment.deployment.auth_url,
+                         'admin_user': slice_deployment.deployment.admin_user,
+                         'admin_password': slice_deployment.deployment.admin_password,
+                         'admin_tenant': 'admin',
+                         'tenant': slice_deployment.slice.name,
+                         'tenant_description': slice_deployment.slice.description,
+                         'roles':roles,
+                         'name':deployment_user
+                         'max_instances':max_instances}
+
+        res = run_template('sync_slice_deployments.yaml', tenant_fields)
+        expected_num = len(roles)+1
+        if (len(res)!=expected_num):
+            raise Exception('Could not sync tenants for slice %s'%slice_deployment.slice.name)
+        else:
+            tenant_id = res[0]['id']
+            if (not slice_deployment.tenant_id):
+                handle = os.popen('nova quota-update --instances %d %s'%(max_instances,tenant_id))
+                output = handle.read()
+                result = handle.close()
+                if (result):
+                    logging.info('Could not update quota for %s'%slice_deployment.slice.name)
+                slice_deployment.tenant_id = tenant_id
+                slice_deployment.save()
+
 
 
     def delete_record(self, slice_deployment):
@@ -96,10 +97,9 @@
             client_driver.delete_router_interface(slice_deployment.router_id, slice_deployment.subnet_id)
         if slice_deployment.subnet_id:
             client_driver.delete_subnet(slice_deployment.subnet_id)
-        if slice_deployment.router_id:    
+        if slice_deployment.router_id:
             client_driver.delete_router(slice_deployment.router_id)
         if slice_deployment.network_id:
             client_driver.delete_network(slice_deployment.network_id)
         if slice_deployment.tenant_id:
             driver.delete_tenant(slice_deployment.tenant_id)
-        
