Fixes as per comments. (+1 squashed commits)

Squashed commits:

[a289d17] Regression and UpgradeRules fix for #5921.