Fixing bug related to stringstreams

Thanks to Jonathan Heusser for reporting this

Related to issue #157