Cherrypick environment swap patch again