Cherry-pick changes from master to 3.0.x.

This should make it up-to-date with stuff through 2013/03/11