major rewrite
fix write/end when not writable
3.0.0