Fix: receiving too much data is now handled properly
Fix: read returns number of bytes written even if it fails to receive packet at some point