add discover plugin, fix some bugs