Change to std::stringstream

Change debug output to use std::stringstream without casts.