Added BufferedOutput
some fixes