Fixing small issue with cppapi and shared_ptr