modify write.cpp