decide to add `write` and `end`
write is ready
fix gc bug