xrange to range and basestring to str