fixed bugs in read_files.py