Fix problem from not clearing stringstreams

Also used unsigned int to stop compiler warnings