fix a bug in run_cmd (when sin is None)