4812. [bug] Minor improvements to stability and consistency of code handling managed keys. [RT #46468]