Added check if a basestring

(rather than a list as expected)
If a string ie 'str' implicitly converts to ['str']

looping though 's','t', 'r' causes failure