Backport pbulk fixes from trunk.