Port the changes from contao/core@7576616c7668e50d3e42e676599fd35a5f332ff3