fixed branch detection