fix some bugs for plugin