set CMD_COUNT to manage command count