fix branch detection