Port the changes from contao/core@a50721152fc861c8effcd954efda15c001cf59cd