Fixed structArray pack/unpack and added tests

Required making `generator` functions on structFields get called only on prep