Port the changes from contao/core@8151215705eb1e40ed27c5aa58ef6d978d453a24