integrating bug #5094 into core-5.12.7