Merged changes from upstream.