diff --git a/src/common/assoc_mgr.c b/src/common/assoc_mgr.c
index dd270454548d879037bb0dd859bac1372e08304b..26d8c647579a7ed0e32e711c4cad1052fa348cbe 100644
--- a/src/common/assoc_mgr.c
+++ b/src/common/assoc_mgr.c
@@ -2042,9 +2042,7 @@ extern int assoc_mgr_update_qos(acct_update_object_t *update)
 	acct_qos_rec_t *rec = NULL;
 	acct_qos_rec_t *object = NULL;
 
-	char *qos_char = NULL, *tmp_char = NULL;
-
-	ListIterator itr = NULL, assoc_itr = NULL, qos_itr = NULL;
+	ListIterator itr = NULL, assoc_itr = NULL;
 
 	acct_association_rec_t *assoc = NULL;
 	int rc = SLURM_SUCCESS;
@@ -2081,41 +2079,74 @@ extern int assoc_mgr_update_qos(acct_update_object_t *update)
 				g_qos_count = object->id+1;
 			}
 			object = NULL;	
-	
 			break;
 		case ACCT_MODIFY_QOS:
-			/* FIX ME: fill in here the qos changes stuff */
+			if(!rec) {
+				rc = SLURM_ERROR;
+				break;
+			}
+
+			if(object->grp_cpu_mins != NO_VAL) 
+				rec->grp_cpu_mins = object->grp_cpu_mins;
+			if(object->grp_cpus != NO_VAL) 
+				rec->grp_cpus = object->grp_cpus;
+			if(object->grp_jobs != NO_VAL) 
+				rec->grp_jobs = object->grp_jobs;
+			if(object->grp_nodes != NO_VAL) 
+				rec->grp_nodes = object->grp_nodes;
+			if(object->grp_submit_jobs != NO_VAL) 
+				rec->grp_submit_jobs = object->grp_submit_jobs;
+			if(object->grp_wall != NO_VAL) 
+				rec->grp_wall = object->grp_wall;
+			
+			if(object->max_cpu_mins_pu != NO_VAL) 
+				rec->max_cpu_mins_pu = object->max_cpu_mins_pu;
+			if(object->max_cpus_pu != NO_VAL) 
+				rec->max_cpus_pu = object->max_cpus_pu;
+			if(object->max_jobs_pu != NO_VAL) 
+				rec->max_jobs_pu = object->max_jobs_pu;
+			if(object->max_nodes_pu != NO_VAL) 
+				rec->max_nodes_pu = object->max_nodes_pu;
+			if(object->max_submit_jobs_pu != NO_VAL) 
+				rec->max_submit_jobs_pu =
+					object->max_submit_jobs_pu;
+			if(object->max_wall_pu != NO_VAL) 
+				rec->max_wall_pu = object->max_wall_pu;
+			
+			if(object->preempt_bitstr) {
+				if(rec->preempt_bitstr) 
+					FREE_NULL_BITMAP(rec->preempt_bitstr);
+				
+				rec->preempt_bitstr = object->preempt_bitstr;
+				object->preempt_bitstr = NULL;
+			}
+
+			if(object->priority != NO_VAL) 
+				rec->priority = object->priority;
+
+			if(object->usage_factor != (double)NO_VAL) 
+				rec->usage_factor = object->usage_factor;
+			
 			break;
 		case ACCT_REMOVE_QOS:
 			/* Remove this qos from all the associations
 			   on this cluster.
 			*/
-			tmp_char = xstrdup_printf("%d", object->id);
 			slurm_mutex_lock(&assoc_mgr_association_lock);
 			assoc_itr = list_iterator_create(
 				assoc_mgr_association_list);
 			while((assoc = list_next(assoc_itr))) {
-				if(!assoc->qos_list
-				   || !list_count(assoc->qos_list))
+				if(!assoc->valid_qos)
 					continue;
-				qos_itr = list_iterator_create(assoc->qos_list);
-				while((qos_char = list_next(qos_itr))) {
-					if(!strcmp(qos_char, tmp_char)) {
-						list_delete_item(qos_itr);
-						break;
-					}
-				}
-				list_iterator_destroy(qos_itr);
+
+				if(bit_size(assoc->valid_qos) > object->id)
+					bit_clear(assoc->valid_qos, object->id);
 			}
 			list_iterator_destroy(assoc_itr);
 			slurm_mutex_unlock(&assoc_mgr_association_lock);
-			xfree(tmp_char);
-
-			if(!rec) {
-				//rc = SLURM_ERROR;
-				break;
-			}
-			list_delete_item(itr);
+			
+			if(rec) 
+				list_delete_item(itr);
 			break;
 		default:
 			break;
@@ -2124,6 +2155,8 @@ extern int assoc_mgr_update_qos(acct_update_object_t *update)
 	}
 
 	if(resize_qos_bitstr) {
+		/* we need to resize all bitstring's that represent
+		   qos' */
 		list_iterator_reset(itr);
 		while((object = list_next(itr))) {
 			if(!object->preempt_bitstr) 
@@ -2133,10 +2166,21 @@ extern int assoc_mgr_update_qos(acct_update_object_t *update)
 				bit_realloc(object->preempt_bitstr,
 					    g_qos_count);
 		}
+
+		slurm_mutex_lock(&assoc_mgr_association_lock);
+		assoc_itr = list_iterator_create(assoc_mgr_association_list);
+		while((assoc = list_next(assoc_itr))) {
+			if(!assoc->valid_qos)
+				continue;
+			assoc->valid_qos =
+				bit_realloc(assoc->valid_qos, g_qos_count);
+		}
+		list_iterator_destroy(assoc_itr);
+		slurm_mutex_unlock(&assoc_mgr_association_lock);
 	}
 	list_iterator_destroy(itr);
 	slurm_mutex_unlock(&assoc_mgr_qos_lock);
-
+	
 	return rc;	
 }
 
diff --git a/src/common/slurm_accounting_storage.c b/src/common/slurm_accounting_storage.c
index 1321ac61976d91597dfca32e41f2e316d47ad24b..969f1b6e754c3df15d6ddcd15e039c900bbcbaed 100644
--- a/src/common/slurm_accounting_storage.c
+++ b/src/common/slurm_accounting_storage.c
@@ -2391,8 +2391,6 @@ extern void pack_acct_qos_rec(void *in, uint16_t rpc_version, Buf buffer)
 			pack32(0, buffer);
 
 			packdouble(NO_VAL, buffer);
-
-			pack32(NO_VAL, buffer);
 			return;
 		}
 		packstr(object->description, buffer);	
@@ -2433,22 +2431,6 @@ extern void pack_acct_qos_rec(void *in, uint16_t rpc_version, Buf buffer)
 		pack32(object->priority, buffer);
 		
 		packdouble(object->usage_factor, buffer);
-
-		if(object->user_limit_list)
-			count = list_count(object->user_limit_list);
-
-		pack32(count, buffer);
-
-		if(count && count != NO_VAL) {
-			acct_used_limits_t *used_limits = NULL;
-			itr = list_iterator_create(object->user_limit_list);
-			while((used_limits = list_next(itr))) {
-				pack_acct_used_limits(used_limits,
-						      rpc_version, buffer);
-			}
-			list_iterator_destroy(itr);
-		}
-		count = NO_VAL;
 	} else if(rpc_version >= 5) {
 		if(!object) {
 			packnull(buffer);
@@ -2662,21 +2644,6 @@ extern int unpack_acct_qos_rec(void **object, uint16_t rpc_version, Buf buffer)
 		safe_unpack32(&object_ptr->priority, buffer);
 
 		safe_unpackdouble(&object_ptr->usage_factor, buffer);
-
-		safe_unpack32(&count, buffer);
-		if(count != NO_VAL) {
-			void *used_limits = NULL;
-
-			object_ptr->user_limit_list = 
-				list_create(slurm_destroy_char);
-			for(i=0; i<count; i++) {
-				unpack_acct_used_limits(&used_limits,
-							rpc_version, buffer);
-				list_append(object_ptr->user_limit_list,
-					    used_limits);
-			}
-		}
-
 	} else if(rpc_version >= 5) {
 		safe_unpackstr_xmalloc(&object_ptr->description,
 				       &uint32_tmp, buffer);
diff --git a/src/common/slurm_accounting_storage.h b/src/common/slurm_accounting_storage.h
index fbe7b53a335d713ba964fc31f47ff9da0d8b6307..fe4a1c72f2af02b79fbb09e7b8521f8b2b26fe87 100644
--- a/src/common/slurm_accounting_storage.h
+++ b/src/common/slurm_accounting_storage.h
@@ -245,6 +245,7 @@ typedef struct acct_association_rec {
 	
 	char *user;		/* user associated to association */
 	bitstr_t *valid_qos;    /* qos available for this association
+				 * derived from the qos_list.
 				 * (DON'T PACK) */	
 } acct_association_rec_t;
 
@@ -343,13 +344,15 @@ typedef struct {
 	char *name;
 	double norm_priority;/* normalized priority (DON'T PACK) */
 	bitstr_t *preempt_bitstr; /* other qos' this qos can preempt */
-	List preempt_list; /* list of char *'s */
+	List preempt_list; /* list of char *'s only used to add or
+			    * change the other qos' this can preempt,
+			    * when doing a get use the preempt_bitstr */
 	uint32_t priority;  /* ranged int needs to be a unint for
 			     * heterogeneous systems */
 	double usage_factor; /* factor to apply to usage in this qos */
 	long double usage_raw;	/* measure of resource usage (DON'T PACK) */
 
-	List user_limit_list; /* acct_used_limits_t's */
+	List user_limit_list; /* acct_used_limits_t's (DON'T PACK) */
 } acct_qos_rec_t;
 
 typedef struct {
diff --git a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
index 5909b09f99506639dc483ed2acec3c8cf37d96c2..5170cbc94f4b0ea4a3f45430294becf9a49e1a75 100644
--- a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
+++ b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
@@ -2189,8 +2189,9 @@ static int _remove_common(mysql_conn_t *mysql_conn,
 	/* we want to remove completely all that is less than a day old */
 	if(!has_jobs && table != assoc_table) {
 		query = xstrdup_printf("delete from %s where creation_time>%d "
-				       "&& (%s);",
-				       table, day_old, name_char);
+				       "&& (%s);"
+				       "alter table %s AUTO_INCREMENT=0;",
+				       table, day_old, name_char, table);
 	}
 
 	if(table != assoc_table)
@@ -2385,20 +2386,14 @@ static int _remove_common(mysql_conn_t *mysql_conn,
 		}
 
 		xstrfmtcat(query,
-			   "delete quick from %s where lft between "
-			   "%s AND %s;",
-			   assoc_table,
-			   row2[0], row2[1]);
+			   "delete quick from %s where lft between %s AND %s;",
+			   assoc_table, row2[0], row2[1]);
 		
 		xstrfmtcat(query,
-			   "UPDATE %s SET rgt = rgt - %s WHERE "
-			   "rgt > %s;"
-			   "UPDATE %s SET lft = lft - %s WHERE "
-			   "lft > %s;",
-			   assoc_table, row2[2],
-			   row2[1],
-			   assoc_table, row2[2],
-			   row2[1]);
+			   "UPDATE %s SET rgt = rgt - %s WHERE rgt > %s;"
+			   "UPDATE %s SET lft = lft - %s WHERE lft > %s;",
+			   assoc_table, row2[2], row2[1],
+			   assoc_table, row2[2], row2[1]);
 		
 		mysql_free_result(result2);
 
@@ -2431,9 +2426,11 @@ just_update:
 			       "max_nodes_per_job=NULL, "
 			       "max_wall_duration_per_job=NULL, "
 			       "max_cpu_mins_per_job=NULL "
-			       "where (%s);",
+			       "where (%s);"
+			       "alter table %s AUTO_INCREMENT=0;",
 			       assoc_table, now,
-			       loc_assoc_char);
+			       loc_assoc_char,
+			       assoc_table);
 
 	if(table != assoc_table)
 		xfree(loc_assoc_char);
@@ -8723,7 +8720,7 @@ empty:
 			qos->name =  xstrdup(row[QOS_REQ_NAME]);
 
 		if(row[QOS_REQ_JOBF] && row[QOS_REQ_JOBF][0])
-		qos->job_flags =  xstrdup(row[QOS_REQ_JOBF]);
+			qos->job_flags =  xstrdup(row[QOS_REQ_JOBF]);
 
 		if(row[QOS_REQ_GCH])
 			qos->grp_cpu_mins = atoll(row[QOS_REQ_GCH]);