fix some bugs and comments