Fix reading from terminal