Implement write

fix #11