Port the changes from contao/core@fa53e9d3b37e384c706bcc32133759a1a417d9f5