Port the changes from contao/core@9d3ea9e649caf138bc59f8f4aa292a2969dbbee0