add write file support
update makefile