rewrote sendcmdM, cwdM