Fixed wrong deinitialization order