fixing a bug for when a plugin is the last in the list