Merge recent fixes from trunk.  Cherrypick of [c43b59dac1], [a221aa82bb], [e1eba1fb09], and [1e131094b5].