Fix data corruption on big messages (fixes #144)

A stable test and a fix included

Patch is submitted under MIT license