Use unlinkSync instead of unlink
Remove duplicated write
Fix assemble
Fix write