gpo: Improve branch detection.