Fixed Shutdown() bugs.