Port the changes from contao/core@deb4f9899c9d3ac9b13848a4de0c9f39b98634cd