Cherry picking two changes to make 3.5 work again.