diff --git a/roles/karaage3.1.17/templates/kg-idps.j2 b/roles/karaage3.1.17/templates/kg-idps.j2
index c4e4c5b355ccfb505cba79ea66b4660a819c7350..10c4ee320986e8b654eacb0427432002495b4e1b 100755
--- a/roles/karaage3.1.17/templates/kg-idps.j2
+++ b/roles/karaage3.1.17/templates/kg-idps.j2
@@ -23,31 +23,24 @@ def get_idps_from_metadata(cache_path):
         
     return idps
 
+def get_group_name(groupname):
+    return re.sub('[!@#=$\s+]', "", groupName).lower()
+
 def get_or_create_idp(entityID,name):
     from karaage.institutes.forms import InstituteForm
     from karaage.institutes.models import Institute
     from karaage.people.models import Group
     try:
-        print "Check institute name = '%s', entityID = '%s'" %(name, entityID)
         institute = Institute.objects.get(saml_entityid=entityID)
-        if institute:
-            print "Find institute name = '%s', saml_entityid = '%s', group name = '%s'" %(institute.name, institute.saml_entityid, institute.group.name)
-        else: 
-            print "Institute name = '%s', entityID = '%s' not found" %(name, entityID)
         return
     except Institute.DoesNotExist:
         try:
-            group, _ =Group.objects.get_or_create(name = name)
+            groupname = get_group_name(name)
+            group, _ =Group.objects.get_or_create(name = groupname)
             if group:
-                print "Get group name = '%s'" %(group.name)
                 institute = Institute(name = name, group = group, saml_entityid = entityID, is_active = True)
                 if institute:
-                    print "Create institute OK: name = '%s', saml_entityid = '%s', group nane = '%s'" %(institute.name, institute.saml_entityid, institute.group.name)
                     institute.save()
-                else:
-                    print "Create institute name = '%s', entityID = '%s' failed" %(name, entityID)
-            else:
-                print "Get group name = '%s' failed" %(group.name)
         except:
             print "Exception: %s" %(traceback.format_exc())