fixed mixed up python2 and python3 usage of str and basestring