Maybe do a .replace(/ /g, '_') here?