modified textio.py