fixed segfault when there is no TERM env var.
fixed compilation with older zlib.