Port the changes from contao/core@d095c12c662aa33543599d1266cf786673cd913b