Regarding CSS, you need to copy the new map header custom code first. It is supposed to overwrite the old code too so don't forget that.
About your 2nd question, you can't do it like that. The object ID is in the form of ASCII, not normal strings so you can't just loop it like that.
Could you tell me how your upgrade works? There maybe alternative approaches.