Port the changes from contao/core@de885a1f300e5dad3041ea70ed0f16045e23d6bd