Port the changes from contao/core@b3b466165b0df29aa4109523d95949ce125cbaa6