Reintroduced termios check (reverted by mistake from my last commit)