restore stream format after changing it, fixes #12