Fix bug in current branch retrieval