Fix bug : when run code without the device connected.