Port the changes from contao/core@2a8f42512a5671c2e1cdd8cae1173ea6be2b1526