Fix truncated messages
Fix some bugs