various bugfixes and addons to plugin system and sample plugin