Port the changes from contao/core@ff5a0fa72a2bda871e4f5cb000a2184d0d5b5fd5