Fixed a couple shutdown issues.