Moving msg_len check uo & local msg_len