replaced basestring and unicode occurrences for python3 compatibility