fix log_io printing beyond end-of-string garbage