Add better checking when pruning.