Fixed wrong shared_ptr usage