Fixed detection of current branch.