Fix reading of data from stdin

The code mistakenly tried to read from stdout which is rather impossible.
Merge pull request #3 from baruch/master

Fix reading of data from stdin