fix Andrei's bug with read stdin

@andreistefanescu please review and let me know if this fixes your issue.