fixed stdin input with isatty (although the test file still gives a wrong result)