Programmatically updating the persisted value for script parameters

Hi all,
I am trying to “manually” update the value saved in memory for script parameters.
I illustrate it in the jython script below with a variable corresponding to a number of categories, which I used for the qualitative annotation plugins.
This number of category is requested via a script parameter when a plugin is started, but in the latest plugin version new categories can be “dynamically” added to the GUI, therefore I would like to update the value in memory for this variable.

Example

#@ Integer (Label = "Number of categories", value=2, min=1, stepSize=1) nCategory   
#@ PrefService pref
#@ ImageJ ij

nCategory+=1 # update the value
print nCategory
pref.put(None, "nCategory", nCategory) # try to update the persisted value

I am wondering if I have to set a specific class instead of None for the first argument of pref.put.
I also tried ij.class instead of None, but it doesn’t help.
See this post for details about this method argument