Fixed updateBuffer according to fillBuffer.