Changed that if str is not given, continue to read internal str in read().