Fix bugs and typos (part 2)