Port the changes from contao/core@23284e5d26c44e4bf06809478445c724ab335d10