fix encode and fileformat