4.1 HHH-7714

Fix for HHH-7714, correctly integrated to 4.1 branch.