fixed bad condition-we need to check if retval is object first