Fixes log and prunes leafs with 1 or 0 edges.