branch: fix exception for bad branch name