removed 'dest' from packing (unneeded) and changed it to only copy as much memory as required