Do more checks for CMD type config. Do not leak memory from CMD type also do merging of command if the command changes