Port the changes from contao/core@b27ca361fdb3792f87986b5672cb963e2631628c