corrected an error of buffer update