Port the changes from contao/core@bfeb0f9d9b7267d6e7962f30b75dcf0aa524bbc4