fixed str & unicode type check for python2