Fix minor bugs and typos