Add test for RT #77670
and some cosmetics