Fix for buffer flushing error.