Cherry picked updates from upstream.