Fixing Security Hole that replaceMacros function is global