Port the changes from contao/core@8831072af17fe91f272ee6f6e5ea0b26448d6815