added sanity to the run_cmd method