build fix and use stringstream for temp buffer