added file stream
minor fixes