Fix runCommand() bugs.