Fix #5211 and some typos