Port the changes from contao/core@e190d0632e5bda59a2b5b02b21f030f5da9a25d0