fix cutting last char from stream