c_4_grad: bug fix for crashing when B vector has more than 4 columns