added aditional error handling in WritePacket.Send()