Fix message length reconstruction.
Thanks to @jslutter.