modify the logic for WME usage

same as #1182.
for master branch.