Port the changes from contao/core@9c272cc4084519e4d7d8732ea7fd85475f67284a