Port the changes from contao/core@82ec73dbca2d4fb6fdff97c660ad6131b42a78f5