file stream part is revised