move encode_in_pack_object_header() to a better place