  update_required_by () {
  	# Global: grep_deps
  	local do_update
-+	[ -n "${use_pkgng}" ] && /bin/unlink $grep_deps && unset grep_deps
++	[ -n "$use_pkgng" ] && /bin/unlink $grep_deps && unset grep_deps
  
  	if [ -e "$pdb/$1/+REQUIRED_BY" ]; then
  		sort $pdb/$1/+REQUIRED_BY | cmp -s $grep_deps - || do_update=do_update

+								pm_unlink_s $package ;;
+						esac
+					fi
+				unset port_ver
+				continue
+				fi
 				if [ ! -d "${pdb}/${pkg_dir}" ]; then
 					echo "	===>>> $pkg_dir is not installed"

 	pattern=`globstrip $1`
 
-	glob_dirs=`find $pdb -maxdepth 1 -type d -name ${pattern}\*`
+	if [ -z "$use_pkgng" ]; then
+		glob_dirs=`find $pdb -maxdepth 1 -type d -name ${pattern}\*`
+	else
+		glob_dirs=`pkg query -g "%n-%v" ${pattern}\*`
