Port the changes from contao/core@1a46f5c0749c00bebf92bf0c4198dba1f2213bb1