clean up cmd.c