redo fix for #17171 because it was causing problems in other places