replace raw pointers in Object with shared_ptr