change write signature/write takes ownership using std::move