Added fix to buffered output stream write() algorithm.
Added fix to buffered output stream write() algorithm.

digitalbazaar/monarch,digitalbazaar/monarch,digitalbazaar/monarch,digitalbazaar/monarch,digitalbazaar/monarch