fixed a bug in unpack
Merge pull request #566 from mikedewar/unpack

fixed a bug in unpack