- modified receive function to work with binary data