Fix: a minor bug in stream writing methods;