resynced from upstream master