fix index calculation in node::branch