Setting the categories to which a parameter definition will be bound

Hey everybody,
I am trying to set the categories to which a parameter can have a value , ie these:


For testing purposes I created two parameters, a shared one and a standard project one:
image
Both are temporarily assigned to only one category:

I then tried running this script:

import clr
clr.AddReference('System')
from System.Collections.Generic import *
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application


params = UnwrapElement(IN[0])

TransactionManager.Instance.EnsureInTransaction(doc) #necessary?
bindings = doc.ParameterBindings

#Create a Categoryset containing all model categories
modcats=sorted([i for i in doc.Settings.Categories if i.AllowsBoundParameters])
allcats=CategorySet()
for cat in modcats:
	allcats.Insert(cat)

#Modify and update parameters
for param in params:
	paramdef = param.GetDefinition()
	item = bindings.Item[paramdef]
	item.Categories=allcats	
	bindings.ReInsert(paramdef,item)

doc.Regenerate() #necessary?
TransactionManager.Instance.TransactionTaskDone()#necessary?

OUT = 0

On the shared parameter it works with no problems:


But on the project parameter it does nothing and no errors appear. If i read the binding’s Categories with python it shows me all of them, but in the Revit UI I can’t see any change (neither in elements or in the project parameter window)

It’s like as if the binding won’t update completely. What else could I try other than bindings.ReInsert , doc.Regenerate, transactions…?
Thanks