Fixed shutdown errors