Fixed a bug in pruneUnused.