Fix more iterators and small bug with stringstream