Fixed a bug when calling plugins from within each loops