Port the changes from contao/core@8bcd1a41a96e2552a4965d71e9601e81944490b2