improvement convertStreamToString