Fix bug on buffers with no final newline.

Fixes #19