Adds a fix for the OSX nosigpipe issue, and adds some debug code for packing/unpacking