Fixed bugs and typos