TLS

- Fixed loop termination bug.
- Chose a better default buffer size.