Fixed shared_ptr's reference counts