check for basestring instead of str