better error stream handling