From #291: fix $TERM check

Thanks to Daniel Serodio (@dserodio) for the catch.