removed unused msg_len
fixed problems with 11