Port the changes from contao/core@23cda32ac854ed5cabc6dc335f4404b7c5150d87