improvement: check terminal_exclude_variables before use