fixed bugs in remove_bad_predecessors.