Cherry pick master #86211ff and resolve conflicts