fixed sigsegv during shutdown