As you are correctly saying, this issue is caused by Cinema4D, not Corona. I looked at your script and it seems to be incorrect. As an example, if you'll have a list of materials called "boing_1, boing, boing", the script will rename the third material to "boing_1", so you'll end up with "boing_1, boing, boing_1".