fix some bugs in the algorithem of bond valence constrain