flushBuffer() invocation added