added ostream check