changing stringstream to ostringstream