Correctly filter out unused keynums in wrap_key. Fixes #57