python3: replaced basestring to six.string_types
python3: fix a long integer usage