Revert "Fixing small issue with cppapi and shared_ptr"

This reverts commit b53c82d411447af679873975bead5ad79f2f4ed2.