fix some bugs and add some enhancement for the plugin