fix some bugs and typos