Port the changes from contao/core@fdeb1b21f0d0250d0d8c131589030cae5b764106