Port the changes from contao/core@f4fb91c2665cab60bcd08fdc83bd7620e8e1fec5