Correctly encode inner message's length, fixes #20