Port the changes from contao/core@52339eb3646a89acfd039ea60fa64a871fcadea8