Have you tried to remove completely the strings or to leave empty strings? (like ``, or ` `)
Because the undefined is usually a javascript way of saying "I'm looking for this, but it's not there". Using empty strings could "solve" the issue without modifying the code, I hope.