Port the changes from contao/core@5ecdc5ef83accc354981e6bf290694bfd6bf1d94