fix bug for bsmf alg