fixed a problem in case of running the program first and then attaching the device.