Regression and UpgradeRules fix for #5921.

Fixes the regression I caused in #5921.
Closes #6039.