Backport some quick changes from 1.6.4.