Fix for jet flavour clustering: Backport from 7_1_X to 7_0_X

Backport of #3994