rewrite unique_ptr usage
fixed error