Fix String#replace in Firefox

Fixes #228.