tighten & simplify write()
test for write()