Fix image download bug if the filename is str rather than unicode