Picked up some fixes from 2.2.3 branch.