fix some bugs in nextBip and optimization of algorithm