BZ-13159: cherry picked from 0821