Fix gcc build, using shared_ptr