Better filestream handling