clean up more compiler warnings etc.
fixed message length field handling.