fixed bugs and typos