fix hanging-shutdown problem