fix shutdown order