Fix for jet flavor lepton selection and possible out of range exception: Backport from 7_2_X to 6_2_X_SLHC

Backport of #4482