fix mac support and rewrite write_object_data.cpp