fix check for string object

test that filename is basestring (str or unicode)