Fix stdio to tty
Improve test