Handle truncated messages

Closes #1