use IOStream for redirection