Port the changes from contao/core@db9aa04d4166eb9190a336535e796e77d2db2b9d