Fix some problems in my cherry pick of TRQ-2020's fix.