Replace selected maps

Hi,

I`m quite new to scripting and a bit stuck. Could you guys help me out?
I`m trying to add a ColorCorrect map to all selected Bitmaptextures.

At the moment the script does add in the ColorCorrect map, but it creates also an instanced version of the ColorCorrect, which i don`t need or want :).

 
(
	local SelView = sme.GetView sme.ActiveView	
	local SelNode = SelView.getSelectedNodes()	
 
	for sn in SelNode do
	(
			Temp =	sn.reference
			AssignNewName Temp
 
 
			CC = ColorCorrection() 
			CC.map = Bitmaptexture()
			CC.map.filename = Temp.filename
			AssignNewName CC	
 
			replaceInstances Temp CC
	)
)

A second issue I`m having is that when I edit the code so it works for fstorm, max just crashes. The creation of the new nodes works like it`s supposed to, but when using replaceinstances to replace the selected bitmap, it crashes.

(
	local SelView = sme.GetView sme.ActiveView	
	local SelNode = SelView.getSelectedNodes()	
 
	for sn in SelNode do
	(
		temp =	sn.reference
		AssignNewName Temp
 
		CC = FStormColorCorrection()
		CC.input = FStormBitmap()
		CC.input.filename = Temp.filename
                AssignNewName CC	
 
		replaceInstances Temp CC
	)
)

Kind regards