add read classes and fix some bugs