What is the best way to change the image for the categoryIcon of a poi already on the map?

I tried changing the image of an existing poi by using:

poi.categoryIcon = img;

but that didn't work.

the only way I could do it was to do that and then put all of the pois in the map again:

map.pois = pois;

but even that only worked with one image and then I could not change a second poi to a different image.