Bug fix in io.py