added error catching to receive_packet