edited to match new functions..
fixed StreamError