remove self-define RAII class and use shared_ptr instead