use shared_ptr instead of normal unsafe pointers now