Fixed replace() syntax which didn't work in Chrome