fix reading from stdin