fixed error in encoding the file content