Fix reading from stdin to handle when chunk is null