Port the changes from contao/core@8f0ab76adfe154d53c497dd825aca6a8975a4011