Add error check to correct_stream_fcn

Fixes #22, passes test suite