Changes in unregister_device  method.