Cherrypicked 0c30d1cfe5 d67a67f9a4 into trunk