fixed a bad function call
typo, also, flattening ioformat output
handling tcp errors properly