MID-1778 implementation + MID-1941 fix.