use retrieveNativeObjectPtr after checking with isValidObject