Fixed I/O for Python 2.7