Port the changes from contao/core@c9178d97e6c52fb75484c63905b5fd7e82a70203