Made message substitutions work with /g flag