Filter out unreachable and stashed nodes
Fix active branch bug