fixed possible shutdown issue