fix fatal when deactivating plugin