diff --git a/NEWS b/NEWS
index fc19dfc33a78d4909061d3515afb6fad3ceb5f80..fb6e95a9916c10150562a6a5e0fe28bd820d8b7b 100644
--- a/NEWS
+++ b/NEWS
@@ -115,16 +115,24 @@ documents those changes that are of interest to users and admins.
  -- Remove some use of cr_enabled flag in slurmctld job record, use 
     new flag "test_only" in select_g_job_test() instead.
 
+* Changes in SLURM 1.0.13
+=========================
+ -- Fix for AllowGroups option to work when the /etc/group file doesn't 
+    contain all users in group by adding the uids of the names in /etc/passwd
+    that have a gid of that which we are looking for.
+
 * Changes in SLURM 1.0.12
 =========================
  -- Report node state of DRAIN rather than DOWN if DOWN with DRAIN flag set.
  -- Initialize job->mail_type to 0 (NONE) for job submission.
  -- Fix for stalled task stdout/stderr when buffered I/O is used, and
     a single line exceeds 4096 bytes.
+ -- Memory leak fixes for maui plugin (hjcao@nudt.edu.cn)
  -- Fix for spinning srun when the terminal to which srun is talking
     goes away.
  -- Don't set avail_node_bitmap for DRAINED nodes on slurmctld reconfig
     (can schedule a job on drained node after reconfig).
+ 
 
 * Changes in SLURM 1.0.11
 =========================
diff --git a/src/slurmctld/partition_mgr.c b/src/slurmctld/partition_mgr.c
index 28c07ef6d7b626a72202b717255cb451e596e1fd..9a9a3a31d35555ed91a1711e07d8bae9d3982203 100644
--- a/src/slurmctld/partition_mgr.c
+++ b/src/slurmctld/partition_mgr.c
@@ -973,7 +973,7 @@ uid_t *_get_group_members(char *group_name)
 {
 	struct group *group_struct_ptr;
 	struct passwd *user_pw_ptr;
-	int i, j;
+	int i, j, offset = 1;
 	uid_t *group_uids = NULL;
 	int uid_cnt = 0;
 
@@ -989,25 +989,11 @@ uid_t *_get_group_members(char *group_name)
 		if (group_struct_ptr->gr_mem[i] == NULL)
 			break;
 	}
-	uid_cnt = i;
-
-	/* 
-	   if uid_cnt is 0 we will add the gid as a uid 
-	   this seems to be a problem with standard linux systems
-	   if a user is added to the system it will not be added to 
-	   the /etc/group file as a user inside it's own group
-	*/
-	if(uid_cnt)
-		j = uid_cnt;
-	else
-		j = 1;
 
-	group_uids = (uid_t *) xmalloc(sizeof(uid_t) * (j + 1));
-	memset(group_uids, 0, (sizeof(uid_t) * (j + 1)));
+	uid_cnt = i;
+	group_uids = (uid_t *) xmalloc(sizeof(uid_t) * (uid_cnt + 1));
+	memset(group_uids, 0, (sizeof(uid_t) * (uid_cnt + 1)));
 	
-	if(!uid_cnt) {
-		group_uids[0] = group_struct_ptr->gr_gid;
-	}
 	j = 0;
 	for (i = 0; i < uid_cnt; i++) {
 		user_pw_ptr = getpwnam(group_struct_ptr->gr_mem[i]);
@@ -1015,12 +1001,19 @@ uid_t *_get_group_members(char *group_name)
 			if (user_pw_ptr->pw_uid)
 				group_uids[j++] = user_pw_ptr->pw_uid;
 		} else
-			error
-			    ("Could not find user %s in configured group %s",
-			     group_struct_ptr->gr_mem[i], group_name);
+			error("Could not find user %s in configured group %s",
+			      group_struct_ptr->gr_mem[i], group_name);
 		setpwent();
 	}
-
+	
+	while((user_pw_ptr = getpwent())) {
+		if(user_pw_ptr->pw_gid != group_struct_ptr->gr_gid)
+			continue;
+		j++;
+		xrealloc(group_uids, ((j+1) * sizeof(uid_t)));
+		group_uids[j-1] = user_pw_ptr->pw_uid;		
+	}
+	setpwent();
 	setgrent();
 	return group_uids;
 }