Bugs 878387, 878168, 876891: fix three closely related auto-correct bugs