fixed bug in pruning