Fixed critial bug

Fixed a bug where encountering an error while testing a function whose
output we were checking left the standard in/out streams to be connected
to an internal buffer. That was weird.