fixes #766 optimize again

avoid loop if empty, forgot about plugin prefixes