fix parse branch logic