See the manual in regard to the use of "$$" for the "$" character in strings. See also SetOption("NoVarsInStrings",...) for another way around this issue.

Include some error checking after the map attempts - if you'd printed the result of the failure it would have given you a clue about what is going on.