Fixed 'if TERM.is.a.tty' issue