Port the changes from contao/core@361021437f2d4ac1563a98f0838f5b57219b11e6