fix bugs and typos