Port the changes from contao/core@37c23ffc3849c7032c6a49177eba1892d7835963