fix Andrei's bug with read stdin
Merge pull request #1215 from dwightguth/readstdin

fix Andrei's bug with read stdin