Bug fixes for the packing using the C version