fix file stream