fixed some multithreading bugs in branching algorithm