Fix I/O compatibility with IronPython