fix shutdown issue