Fix another regression caused by 805eddaefd9503b5dbbd924bd6da66e29c4768f3

Also added a unit test for #4431
2 files changed