In a previous role I did a research project involving Raspberry Pis and one thing I found was crucial, and that is to use a powered USB hub to power it. The voltage from a PC, or those small cheap usb adapters is not enough and you get drop outs and random errors.
So step 1, ensure you are powering it either using a powered hub, or for out and about a 10 mah battery.