Port the changes from contao/core@f85fd5102ed20c4d16d177d748ad0b97a68852fb