Fixed problem with orderly shutdown.