Using sstream to avoid FreeBSD g++ bug