Corrected packing of arrays

Arrays with multiple elements are now packed correctly.

Fixes #1.