Port the changes from contao/core@d74d58ac92d696faa0acc6cc1b8328151d6ba2c6