Fixed shutdown issue