return error for Write() and WriteTo()