Some tests and fixes for pack() and unpack()