use write() instead of add()