fix latent javascript replace-with-'' bug