flatten bNode tree