Cherry picked from 3.0