checking that there remain $oldwrappedids before deleting them lines 87-..