Rewrite command_exists to get return value