Fix bugs, errors and typos