fix library deduplication (fix #565)

`pack()` / `unpack()` must be wrapped around every `list_append_deduplicate()` call since the input data might come from a recursive invocation which is not packed anymore.