improved unpacking