Refactored the code to check for conn->primary before allocating space again when initializing replicateset
Refactored initialization of members on bson_create only to initialize members that would cause mongo_destroy to fail