fix return semantics for Write() calls