Synced patch with upstream changes.