fix bug where precision in stream is not restored to original value