Port the changes from contao/core@3a8738b4bf002e913628f87b764b4308ea36a07c