Better error reporting and tty reset.