Cherrypick 42d8c2071ed1aeb017fa5db913c7eb0bc08a17ef (monkey patch)