Fixed label transform function to do global replacements