Port the changes from contao/core@1cf58e19da75a2467b043d971455725ac05071c1