Fix MacOS X non-blocking bug, and workaround OS bug (by limiting amount of data on each write).