improve get_branch errors