Port the changes from contao/core@89cd48af21f88a1ca45428a5f197aee177bd61f9