Port the changes from contao/core@d7c7a13211183b6b2d7c85c877f9a42d00c563c2