Port the changes from contao/core@fd0d7c0980dfdd88919cc66d1fa506326b1681f4