Port the changes from contao/core@b12c35c8c51bcd8cfc4ed605829659e922222e6f