use gsub instead of split/join