fix deactivating a device