Fixed usb read/write functions