Port 1.4 changes to the 2.0 branch.

Port 1.4 changes to the 2.0 branch.

@metadave