Changed validation of strings to basestring from str.