Port the changes from contao/core@58f237afac3c58fe83fef6b86aee7ca0ad89ceaf