better handling for the case when the plugin is invoked on a set of multiple elements