fix the fundamentally broken implementation of unpackArray