Fix crash when pruning