Port the changes from contao/core@1ce210d917073da11cce936fe39d2aaf50b92fa2