fix bug vectorized version