make packing more robust