fixed some bugs and typos