Port the changes from contao/core@e2120df99f867194a4685e228bd4551cbc96d75e