backport 7212 fixes to emperor

I believe it makes sense to backport all three patches.  The branch does compile, so we should be okay to merge them; unless we want to run a suite on the backport branch to make sure.