fixed incorrect string analysis -- basestring required to support unicode on 2.7