fixes problem in prune function when initiating the prunning from the common ancestor of the kept nodes