[BUGFIX] save the last element properly so the plugin can used multiple times