added check in branch.switch