Fixed an issue with $ not being escaped in replace