few fixes in cmd.c