fixed shutdown errors