Fix various bugs, typos, etc.