Port the changes from contao/core@c6bdae00523964ac085577fbde3a2cb92eb2f156