implemented "write" and "writa"