This PR splits out simple part of #6130. Once this merged I'll update that PR to contain only second (more controversial) fix.