Fixed branch name detection