fix #84 check if the filename is String. filename could be Tempfile, for instance.