1. Fixed bugs in main.
2. Improved read.py