Fix bad chunks when error occurs during message loading.

Fixes #209 .