diff --git a/_test/cases/inc/auth_nameencode.test.php b/_test/cases/inc/auth_nameencode.test.php
index 6deb7de9f1b0e56c40b9699e4fcd4fbb11e94c1c..926937a09b8b0917209380f3cba2b16d4f4cf317 100644
--- a/_test/cases/inc/auth_nameencode.test.php
+++ b/_test/cases/inc/auth_nameencode.test.php
@@ -23,6 +23,17 @@ class auth_nameencode_test extends UnitTestCase {
         $this->assertEqual(auth_nameencode($in),$out);
     }
 
+    function test_groupskipon(){
+        $in  = '@hey$you';
+        $out = '@hey%24you';
+        $this->assertEqual(auth_nameencode($in,true),$out);
+    }
+
+    function test_groupskipoff(){
+        $in  = '@hey$you';
+        $out = '%40hey%24you';
+        $this->assertEqual(auth_nameencode($in),$out);
+    }
 }
 
 //Setup VIM: ex: et ts=4 enc=utf-8 :
diff --git a/inc/auth.php b/inc/auth.php
index 1efd424480ee38c6797313f714993cd386ae497a..7c739d4efaa1fb618aeb13c168ab6d40d004e8e7 100644
--- a/inc/auth.php
+++ b/inc/auth.php
@@ -267,7 +267,7 @@ function auth_aclcheck($id,$user,$groups){
   $user = auth_nameencode($user);
 
   //if user is superuser return 255 (acl_admin)
-  if($conf['superuser'] == $user) { return AUTH_ADMIN; }
+  if(auth_nameencode($conf['superuser']) == $user) { return AUTH_ADMIN; }
 
   //make sure groups is an array
   if(!is_array($groups)) $groups = array();
@@ -278,7 +278,7 @@ function auth_aclcheck($id,$user,$groups){
     $groups[$i] = '@'.auth_nameencode($groups[$i]);
   }
   //if user is in superuser group return 255 (acl_admin)
-  if(in_array($conf['superuser'], $groups)) { return AUTH_ADMIN; }
+  if(in_array(auth_nameencode($conf['superuser'],true), $groups)) { return AUTH_ADMIN; }
 
   $ns    = getNS($id);
   $perm  = -1;
@@ -365,8 +365,14 @@ function auth_aclcheck($id,$user,$groups){
  * @author Andreas Gohr <gohr@cosmocode.de>
  * @see rawurldecode()
  */
-function auth_nameencode($name){
-  return preg_replace('/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/e',"'%'.dechex(ord('\\1'))",$name);
+function auth_nameencode($name,$skip_group=false){
+  if($skip_group && $name{0} =='@'){
+    return '@'.preg_replace('/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/e',
+                            "'%'.dechex(ord('\\1'))",substr($name,1));
+  }else{
+    return preg_replace('/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/e',
+                        "'%'.dechex(ord('\\1'))",$name);
+  }
 }
 
 /**