Trim long buffers

Fixes #338

That was easy! :D