Add missing g flag to .replace regexp