Added check for existence of isatty on stdout before calling it