Fix wire protocol coding for large messages