fixed some bugs in prune (not properly pruning tree)