Forward-port the I/O wrapping code Dave Raynor wrote to fix an older bug that happened in the hashing code