diff --git a/src/plugins/sched/backfill/backfill.c b/src/plugins/sched/backfill/backfill.c
index fdcabfd0a5d76863bc0b9cb48bbcdab4746e4ab1..404564b1d2830a530df6f07a1deb541ced858b62 100644
--- a/src/plugins/sched/backfill/backfill.c
+++ b/src/plugins/sched/backfill/backfill.c
@@ -14,7 +14,7 @@
  *  "lx[06-08]", we can't start it without possibly delaying the higher 
  *  priority job.
  *****************************************************************************
- *  Copyright (C) 2003 The Regents of the University of California.
+ *  Copyright (C) 2003-2006 The Regents of the University of California.
  *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
  *  Written by Morris Jette <jette1@llnl.gov>
  *  UCRL-CODE-217948.
@@ -79,8 +79,9 @@ typedef struct node_space_map {
 } node_space_map_t;
 
 /*********************** local variables *********************/
-static bool altered_job = false;
-static bool new_work = false;
+static bool altered_job   = false;
+static bool new_work      = false;
+static bool stop_backfill = false;
 static pthread_mutex_t thread_flag_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 static List pend_job_list = NULL;
@@ -93,7 +94,7 @@ static node_space_map_t node_space[MAX_JOB_CNT + 1];
 /* Set __DEBUG to get detailed logging for this thread without 
  * detailed logging for the entire slurmctld daemon */
 #define __DEBUG        0
-#define SLEEP_TIME     2
+#define SLEEP_TIME     1
 
 /*********************** local functions *********************/
 static int  _add_pending_job(struct job_record *job_ptr, 
@@ -162,6 +163,13 @@ static void _diff_tv_str(struct timeval *tv1,struct timeval *tv2,
 	snprintf(tv_str, len_tv_str, "usec=%ld", delta_t);
 }
 
+/* Terminate backfill_agent */
+extern void stop_backfill_agent(void)
+{
+	stop_backfill = true;
+}
+
+
 /* backfill_agent - detached thread periodically attempts to backfill jobs */
 extern void *
 backfill_agent(void *args)
@@ -175,9 +183,9 @@ backfill_agent(void *args)
 
 	if (slurm_get_root_filter())
 		filter_root = true;
-	while (1) {
+	while (!stop_backfill) {
 		sleep(SLEEP_TIME);      /* don't run continuously */
-		if (!_more_work())
+		if ((!_more_work()) || stop_backfill)
 			continue;
 
 		gettimeofday(&tv1, NULL);
@@ -210,6 +218,7 @@ backfill_agent(void *args)
 			schedule();	/* has own locks */
 		}
 	}
+	return NULL;
 }
 
 /* trigger the attempt of a backfill */
diff --git a/src/plugins/sched/backfill/backfill.h b/src/plugins/sched/backfill/backfill.h
index 2db7e766bbd1903c438af1692d1ef84c7a395ec0..e960a3df0376e25ff57c9433eb0403ae3cef8a6c 100644
--- a/src/plugins/sched/backfill/backfill.h
+++ b/src/plugins/sched/backfill/backfill.h
@@ -38,6 +38,9 @@
 /* backfill_agent - detached thread periodically attempts to backfill jobs */
 extern void *backfill_agent(void *args);
 
+/* Terminate backfill_agent */
+extern void stop_backfill_agent(void);
+
 /* trigger the attempt of a backfill */
 extern void run_backfill (void);
 
diff --git a/src/plugins/sched/backfill/backfill_wrapper.c b/src/plugins/sched/backfill/backfill_wrapper.c
index dbf33c67cc7382d50cb1dc314949c69d2ae5430e..3663aaf9a1e72dc14dff6bde1f6beb8d21b2e0e6 100644
--- a/src/plugins/sched/backfill/backfill_wrapper.c
+++ b/src/plugins/sched/backfill/backfill_wrapper.c
@@ -112,6 +112,7 @@ void fini( void )
 	pthread_mutex_lock( &thread_flag_mutex );
 	if ( backfill_thread ) {
 		verbose( "Backfill scheduler plugin shutting down" );
+		stop_backfill_agent();
 		_cancel_thread( backfill_thread );
 		backfill_thread = false;
 	}
diff --git a/src/slurmctld/controller.c b/src/slurmctld/controller.c
index e453404b45e02fdb9e5f6d50428d99ec3b24def9..8c4a2a9c5d4b1529a4ebfecd95c64d67655ad292 100644
--- a/src/slurmctld/controller.c
+++ b/src/slurmctld/controller.c
@@ -377,7 +377,7 @@ int main(int argc, char *argv[])
 	slurm_cred_ctx_destroy(slurmctld_config.cred_ctx);
 	slurm_conf_destroy();
 	slurm_api_clear_config();
-	sleep(1);
+	sleep(2);
 #endif
 
 	info("Slurmctld shutdown completing");