Port the changes from contao/core@e0213102053421a5840fabcd3d2069a749de21e2