fixing crash for device_lost using undefined _self

fixes an unhandled exception that occurred when checking for expired devices and emitting the device_lost event caused by use of undefined variable _self.