Minor tweaks - better reaction to shutdown.