Updated CmdClearAllDone with defensive programming

Updated CmdClearAllDone with defensive programming