moved stream write