bug fix in handling of cmd