Adding logic to make permissions correct
Fixing case when no usb device is connected