Port the changes from contao/core@11b6b0f13818d86a0300f88f8390a48ceb7f1a8f